Live data from Hacker News

Understanding the Layout Process in Qt Widgets

felipefarinon.com

21–30 of 47 posts

Re: Understanding the Layout Process in Qt Widgets

#21

Managing widget size and layout in complex UIs is definitely one of the more challenging aspects of programming with Qt. But you usually get what you want with a bit of trial and error.

I am running up against it now. While QT works on the major OSes, it somehow manages to not quite fit with the design of the OS - which drives me crazy. If I wanted it to sort of behave like a Windows app, I'd write Windows apps. Sadly, it's the best option for Python.

I think Qt looks and feels pretty native on Windows. It doesn't look quite as native on Mac, but it's not far off.

Re: Understanding the Layout Process in Qt Widgets

#22

Managing widget size and layout in complex UIs is definitely one of the more challenging aspects of programming with Qt. But you usually get what you want with a bit of trial and error.

Qt has a chronic problem with High DPI displays, especially when mixed with a lower DPI display in a multiple monitor situation. You will never get it 100% right and when you start shipping it to users that percentage will fall quickly.

Re: Understanding the Layout Process in Qt Widgets

#24

I’d love to see an article on Qt text layout processing.

That's actually a great idea for a second follow up article. I've worked a lot with rich text and custom text objects, but would also like to explore itemization and the lower level layers.

What would you like to know more about it?

Re: Understanding the Layout Process in Qt Widgets

#25

I'm curious why you chose Qt Widgets for a relatively new application? Is desktop support that much better than QML? There's a bunch of tradeoffs for everyone who has to make that choice and it's always interesting to know why people choose the one that they do.

QML wasn't (at least in the Qt5 days) a good fit for traditional desktop style applications. It was nice for more multimedia touch screen stuff, but HTML5 in an embedded browser like CEF or Electron was catching up fast and with much better third party library support.

Re: Understanding the Layout Process in Qt Widgets

#26

I'm curious why you chose Qt Widgets for a relatively new application? Is desktop support that much better than QML? There's a bunch of tradeoffs for everyone who has to make that choice and it's always interesting to know why people choose the one that they do.

I can't speak for the author, but many systems programmers look at declarative/markup-based UI as a kind of black magic that you can't trust and that will get in your way sooner or later by not leaving a sane way for you to address some project requirement. We/they are often way more comfortable working with the kind of programmatic widget and graphics library that we/they might write, and whose behavior we can debug…

> I can't speak for the author, but many systems programmers look at declarative/markup-based UI as a kind of black magic that you can't trust and that will get in your way sooner or later by not leaving a sane way for you to address some project requirement.

This exact scenario has played out for many trying to adopt SwiftUI. For even moderately complex projects it’s common to get 90% of the way there fairly easily, only for that last 10% to be a struggle/slog as a result of its inflexibility. AppKit/UIKit may not be trendy or sexy and might take longer to get new projects spun up with, but it’s much more rare to hit that brick wall with them; you’ll probably be able to accomplish what you need with little or no pain.

I’ve seen shades of this in Jetpack Compose too, which makes me think that these sorts of problems are just inherent to the type of UI framework.

Re: Understanding the Layout Process in Qt Widgets

#27

Earlier quoted context omitted.

I can't speak for the author, but many systems programmers look at declarative/markup-based UI as a kind of black magic that you can't trust and that will get in your way sooner or later by not leaving a sane way for you to address some project requirement. We/they are often way more comfortable working with the kind of programmatic widget and graphics library that we/they might write, and whose behavior we can debug…

> I can't speak for the author, but many systems programmers look at declarative/markup-based UI as a kind of black magic that you can't trust and that will get in your way sooner or later by not leaving a sane way for you to address some project requirement. This exact scenario has played out for many trying to adopt SwiftUI. For even moderately complex projects it’s common to get 90% of the way there fairly easily,…

I'm curious to hear more about those problems. Do you have any articles covering them in more depth?

Re: Understanding the Layout Process in Qt Widgets

#28
QGridLayout is my go-to for applications. I like how it allows a responsive design when resizing. Most of my desktop apps are for simplifying tasks that my coworkers and me are doing, so no one's expecting the most professional look and Qt has gotten the job done.

Have you used Qt Creator? Once I started using this, my app development started flying because I didn't have to edit, run program, edit again. Just drag and drop widgets around, its very nice.

Re: Understanding the Layout Process in Qt Widgets

#29

Earlier quoted context omitted.

> I can't speak for the author, but many systems programmers look at declarative/markup-based UI as a kind of black magic that you can't trust and that will get in your way sooner or later by not leaving a sane way for you to address some project requirement. This exact scenario has played out for many trying to adopt SwiftUI. For even moderately complex projects it’s common to get 90% of the way there fairly easily,…

I'm curious to hear more about those problems. Do you have any articles covering them in more depth?

I've seen a few blogposts on the subject over the years but wouldn't be able to reference any of them on short notice.

In short though, frameworks like SwiftUI tend to be designed around a very narrow set of use cases and if yours deviates from those in any way you're in for a bad time, and depending on how great the deviation is will likely land you with falling back to older imperative frameworks for their more customizable/hackable widgets in places (if that's an option) or dropping the declarative framework altogether.

Re: Understanding the Layout Process in Qt Widgets

#30

QGridLayout is my go-to for applications. I like how it allows a responsive design when resizing. Most of my desktop apps are for simplifying tasks that my coworkers and me are doing, so no one's expecting the most professional look and Qt has gotten the job done. Have you used Qt Creator? Once I started using this, my app development started flying because I didn't have to edit, run program, edit again. Just drag an…

Why do your prefer it over https://wxwidgets.org given the licenses?

Personally, I was keen on Qt right up to the 5.x change over. =3

Post reply on HN