This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I add resizable widgets in Qt Creator?
I am using QTreeView and QListView and i want to make them to be sizable i.e. when i go the top end of the QTreeview the pointer should be transformed into a vertical arrow which allows me do a up resize by mouse drag and drop, a feature that is seen on many application nowadays.
How can be achieved this? Thank you.
You can put your widgets into a QSplitter.
Related
This question already has answers here:
Win32 Splitter Control
(4 answers)
Closed 3 years ago.
Using Win32 not MFC, how would I create a resizable or split controls?
As an example, a window with two edit controls side by side with the ability to resize them with a common divider. In the same way this dialog box can resized.
Not necessarily after a full example just a point in the right direction. Everything I lookup is about resizing entire windows not single controls (windows) inside the parent window.
Edit
Added image is show my example.
Everything I lookup is about resizing windows not controls.
Well, suddenly controls are, in fact, a windows as well, just visually little bit different.
Resizing controls is the same as resizing the window. In Win API it's handled by SetWindowPos function.
To properly resize controls when your window is resized you have to handle WM_SIZE Windows message in your main window and then resize/move your controls accordingly.
Updated:
After looking at your image:
Basically, if i understand your intentions, you need some custom divider/control, dragging which will eventually resize/move corresponding edit controls. Right?
In terms of pure Win API you will have to implement such control/divider in form of... another window.
In this window you will have to handle mouse clicks/moves and then do whatever you want with the (somehow) linked edit controls (basically implement all the logic).
Frankly saying this is not a very trivial task and that is what frameworks are here for (MFC, etc...).
I'd like to have a Qt widget (QPushButton), in which caption starts(!) from the center. How can I achieve it? I use Qt 5.12.x, C++, Windows. Is rewriting paintEvent the only way? I'd like to study "math" sample for it.
This question already has answers here:
How do I add a background image to the QMainWindow?
(3 answers)
Closed 4 years ago.
Is there a way to change the style of the main window of the program from the standard style to the style of the png file (so that the window's appearance was like in the launcher of some online games)?
something like this (the best example from game GW2)
You don't do this sort of thing by making the image somehow spill out of the window, you do it by making a window large enough to hold the image and making the window background transparent. The Qt way to do this is using the Qt.WA_TranslucentBackground window flag (together with FramelessWindowHint).
ui->setupUi(this);
this->resize(1280,950);
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
this->setStyleSheet("#centralWidget { "
" border-image: url(:/gw2.png);"
"}");
connect(ui->pushButton, SIGNAL(clicked(bool)), qApp,
SLOT(closeAllWindows()));
result
I'm trying to make a questionnaire with Qt, using Qt Designer to design the forms.
I want to display each question and the possible answers on a line, one question under the previous one. The problem is that I've got too many question to fit in my window.
I tried using qtscrollarea but I can't manage to get the scroll bars....
I am using QtDesigner, I put a qtscrollarea, with a vertical layout in it, adding the QWidgets containing question and answers in the vertical layout. I tried to force the vertical layout to be bigger than the qtscrollarea, tried to change somme Qwidget to horiontal layout, taking off the vertical layout... But still no way to have a scroll bar.
Any advice on a way of doing it through QtDesigner?
Try this:
place a qtscrollarea
place in qtscrollarea widgets containing question and answers
right click on qtscrollarea and select layout, vertical in your case
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Implement Resize option to Qt Frameless widget
I want to add resize option in my QMainWindows that is Frameless window, How can i add this feature to it?
please explain me with code
You can use QSizeGrip