-
Notifications
You must be signed in to change notification settings - Fork 70
[QMS-903] Convert CMapItemWidget into CMapItemDelegate #935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
ecd914f to
5f46c93
Compare
|
My visual impressions with Windows 11, Qt6.10.0, GDAL 3.11.5, proj 9.6.2:
What else has been changed with this PR? and (most likely not related to this commit/PR): long waiting times before the splash screen disappears (seems to be caused by the relatively large number of views in the configuration and/or the Routino initialisation with several routing databases). The main GUI is visible for quite some time below the splash screen. |
|
Only change is how map and dem list items are displayed. The stall of the UI (splash and while switching maps/dem) is due to most stuff is handled in the UI thread, some in other threads and mutex protecting the complete stuff. The moment the UI tries to lock one of the mutex and the mutex is owned by another thread everything has to wait for that thread. It would be much better to do most stuff in threads and signalling the UI when done. However this not trivial and I do not see a solution without rewriting large portions of code. The crash is very likely not related to that PR. This is really just affecting the map and dem lists. But the rest is promising. The main advantage is the proper visual selection and drag-n-drop behavior. |
|
If possible, it were nice to see map's and/or dem's full string as a tooltip when hovering over item. |
Good catch. Added cropping. And tool tip if name is not fully visible. |
If I know where I can look so that you have the necessary information, then I will gladly do that. |
|
In screenshots from @eyzdh. activation buttons not only do not looking square but they are missing the white square background surrounded by gray edges. |
|
If of interest: With Windows build, buttons are square! Everything ok. |
Get latest code. In CMapItemDelegate.cpp line 240 you will find:
you can print the rectangles to the debug output :
and check if the out matches the expectations. You will get a lot of lines like: The x/y offset is not of interest but the sizes like If that does not fit you have to find out why. Placing qDebug() in the code or use a debugger. |
a9dca60 to
3f2d17f
Compare
|
I did it with you latest code - its the same size like my screenshot and I played with terminal a bit more, in this file more information what qt does, maybe it helps |
|
The link to the first file is dead. And I lack the time to work myself thru the 19MB of text garbage of the second link. Please, keep debug information as short and precise as possible. |
|
QRect extract of 19 MB data: |
|
Ok, thanks! 😄 The math seems to be ok. This reduces the problem to QStyleOptionButton used in the delegates paint method. Maybe this lacks some flag or call. The only way to find out is to go thru the docs and examples and try to add stuff. But please do not throw in everything. Try to single out the real root cause. My first try would be: |
ok for the next time I will do that. Thanks @JFritzle |
|
Good work!. Does it make sense to set style Fusion if no --style is provided? Can you please provide a patch? |
|
I asked our new friend Copilot and it is suggesting, too, might be the missing call to |
|
Sorry, buttons still not square. Built-in style is "macOS". We could certainly force style "Fusion" when no style gets passed by command line. |
|
@mitxel-m good catch! Needs to be fixed. |
|
@eyzdh can you provide code for the first one? Copy-n-paste the changed code into a text file and attach. |
|
replace code line 242 until 276 with: |
|
Sorry wrong code, this is the right one |
Ok, but here we have the problem that this does not take any style into account. This is why a styled button is used. The buttons must match all the other buttons in the application. In colors as well as in how it's drawn. Look at all the screenshots in this PR for examples. That's why we need to get the styled button to work. |
|
@mitxel-m fixed your catch. |
Make sense, I will also try to get the styled button to work |

















What is the linked issue for this pull request:
QMS-#903
What you have done:
This is a house keeping PR. It does not change any functionality. It changes the code to (hopefully) something better.
@mitxel-m @wthaem @JFritzle and all others: Please test!
I introduced CMapItemWidget to have a better UI for the map and DEM items. Qt does not recommend using item widgets for reasons. Those reasons are biting and as I would like to extend the UI pattern to GIS projects etc. a proper solutions needs to be established.
The proper solution is called QStyledItemDelegate. It has several advantages:
Drawback:
Anyways QStyledItemDelegate is the way to go. Functional wise there should be no difference. Visually there are some small differences.
Steps to perform a simple smoke test:
Use maps and dems as you always do.
Does the code comply to the coding rules and naming conventions Coding Guidelines:
Is every user facing string in a tr() macro?
Did you add the ticket number and title into the changelog? Keep the numeric order in each release block.