Skip to content
This repository has been archived by the owner on Sep 1, 2019. It is now read-only.

job tab: ui improvement #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

job tab: ui improvement #19

wants to merge 1 commit into from

Conversation

rssdev10
Copy link
Contributor

@rssdev10 rssdev10 commented Feb 4, 2017

Hi, good start!

I changed layouts on the job tab to make it some more readable.

And small recommendation. If you want to continue development and save controllable the process of collaborative development, don't use UI compiler. It is really only for prototyping. In other case each time when somebody changed UI, you will see something like in my patch. That is totally changed instead of several lines of code only. Moreover direct changing of cpp code is more flexible and clear for understanding. If you want to do it, just copy and decorate code from generated ui_something_.h files to your main cpp files.

@mmozeiko
Copy link
Owner

mmozeiko commented Feb 5, 2017

Could you explain why this looks to you? Previously number fields (counts/bandwidth/time) where nicely aligned to left and stayed there regardless of window size. Now everything is resizing and moving around. If you have nice big monitor and if you maximize window, those three groups of fields will be very apart each from another. I don't see this as improvement.

I see you put & shortcuts for some fields. But it seems you skipped Bandwidth and Errors?

I actually really like Qt ui files. They allow me to see widget layout without launching application. Previously I worked with company where we made all the GUI with ui files and there were no issues of collaboration and changing it. If your concern is about looking at diff of xml file, then having controls created in C++ code will not be much better. Here's how diff for ui generated header looks like with your change: https://gist.github.com/mmozeiko/93637939b7ab0acdba410e788e018d86 Sure, the first part with field definitions really should not change, but most of the other stuff is mostly valid changes.

And for bigger changes the pure C++ diffs (without uic) will anyway be messy - different developers like to structure code differently. Some will create controls at one place and set their properties in different. Some will create control and immediately will set all properties (like uic generated code does).

@rssdev10
Copy link
Contributor Author

rssdev10 commented Feb 5, 2017

Try to increase width of the job window in your implementation. You will see fields: Size, Transferred, bandwidth, Errors, Elapsed, Checks as groped to left side with space at left. In my case it is uniform aligned. I changed your grid layout for the job form to vbox with separate grouping of elements per each line.

Regarding & shortcuts, probably it is automatically added by qt designer. I didn't change it manually.

I actually really like Qt ui files.

I worked with Qt many years. Mostly with qt3 and a bit with qt4. Not sure that it changed so big in qt5. It is really much clear to work with pure code especially when you have something complex like tables with custom behavior. And you can combine different approaches for different forms.

For your example of cpp code:

-    QGridLayout *gridLayout_2;
-    QSpacerItem *horizontalSpacer;
-    QLineEdit *transferred;
-    QLineEdit *errors;
-    QLabel *label_7;
-    QLabel *label_8;
-    QLabel *label_6;
-    QLineEdit *size;

I have an issue. Not all variables for objects are declared in h-file. There is a simple principle. If you don't want to use an object outside a constructor you doesn't declare variables at h-file. That is most code is concentrated in same place.

For qt5 actually consider usage of QML. But in general do it as you wish.

different developers like to structure code differently.

You can specify coding style if you want to organize a process of collaborative development. And next just control it.

As you decided to implement GUI for very popular tool you can head the process of further development. Or do it self as you wish.

@mmozeiko
Copy link
Owner

mmozeiko commented Feb 5, 2017

In my case it is uniform aligned

Not sure if I understand what is aligned. This is what I see: http://imgur.com/a/9tSTA
In your case there is huge space between all three vertical groups. In my old UI all items are nicely on left side, and empty space is only in one place - right side. That's how I wanted it, because those small line-edits are not resizeable (there's no point resizing them when they need to show only one integer value or similar).

If you don't want to use an object outside a constructor you doesn't declare variables at h-file

This is easy to change. Because these header files are "private" to UI object and never meant to be used elsewhere, then simply #include "ui_job_widget.h" to job_widget.cpp and forward declare Ui::JobWidget class in job_widget.h file, so it member in JobWidget class can be a pointer. I didn't do that, because it is extra typing work. And for this kind of project structuring C++ classes "properly" doesn't matter much. IMHO that matters much more for libraries, not for UI code that is never meant to be reusable.

For qt5 actually consider usage of QML.

I actually dislike QML for desktop apps. It requires writing code in different language than C/C++ which is not nice in my opinion. And it will increase app total size, because of more extra dll or other files. This thing about putting wrappers over wrappers never stops... After QML somebody will request to rewrite everything in JS with Electron (or similar).

@rssdev10
Copy link
Contributor Author

rssdev10 commented Feb 5, 2017

I don't like discuss UI because of it is really very subjective. But if you want to discuss more about qt development, coding style, c, c++ programming just email me privately.

In my old UI all items are nicely on left side, and empty space is only in one place - right side.

It is not nice due to looks very asymmetric. I guess even a central position of the block with all elements looks better because of symmetry.

Actually in my case it looks symmetric in any case. You are right it looks not good in case of full screen. But if you extend the job window not so wide it looks good because of strictly aligned both left and right.

At the same time if you aligning each line separately instead of common grid for a form you have more flexibility.

Good luck!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants