Source Code (Gui Example 4) from CopperSpice Journal Homepage.
If class MainWindow : public QWidget - all good works.
Is little change code: class MainWindow : public QMainWindow - widgets are not displayed in the window.
I suspect that the invisible remains layoutMain :
QVBoxLayout *layoutMain = new QVBoxLayout(this);
I also tried
QVBoxLayout *layoutMain = new QVBoxLayout(centralWidget()); // this not works!
The second question is about Copper Space Designer.
I have generated the wrong code for QToolBar in the ui_PrabhupadaDictionaryWindow file.h:
PrabhupadaDictionaryWindow->addtoolbar(Qt::, tbPrabhupada);
I have to edit the code manually:
PrabhupadaDictionaryWindow->addToolBar(tbPrabhupada);
The third question:
Here I am in CopperSpice Designer making the window the successor of QMainWindow, then I add QVBoxLayout. I want this QVBoxLayout to automatically expand to the entire available area of the window (like Align = alClient in Delphi or C++Builder), but it just has a fixed size and position and is not tied to the size of the window in any way.
The fourth question:
Is it possible in CopperSpice Designer to install a button with a question mark in the window title. Maybe I don't understand it that way, but it seems to me that such a button is needed to show the whatThis property. How should the user view the whatThis property for different Widgets?
With best regards, Navavdvipa Chandra das.
What is the secret of QMainWindow? And other questions.
-
- Posts: 24
- Joined: Sun Apr 19 2020 7:02 pm
-
- Posts: 24
- Joined: Sun Apr 19 2020 7:02 pm
Re: What is the secret of QMainWindow? And other questions.
I watched several videos and found answers to my three questions. And one question remained, as it was associated with incorrect code generation by the utility uic.exe .
1. When inheriting a window from QMainWindow in the window constructor, we first need to create a centralwidget, and only then create the main Layout based on cetntralWidget. This is what the code generated by CopperSpice Designer and the program looks like uic.exe . If you write with your hands then you still have to go the same way.
2. PrabhupadaDictionaryWindow->addtoolbar(Qt::, tbPrabhupada);
Incorrect code generation! The QToolBar::allowedAreas property is not editable in the "Property Editor". It shows an empty line and nothing can be changed! It slows down the work very much!
3. A special button at the top "Lay Out Vertically" helped.
4. You can make a special button yourself with something like this code
and the problem of showing WhatsThis solved!
Thank you!
With best regards, Navavdvipa Chandra das.
1. When inheriting a window from QMainWindow in the window constructor, we first need to create a centralwidget, and only then create the main Layout based on cetntralWidget. This is what the code generated by CopperSpice Designer and the program looks like uic.exe . If you write with your hands then you still have to go the same way.
Code: Select all
centralwidget = new QWidget(PrabhupadaDictionaryWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
vlPrabhuadaMain = new QVBoxLayout(centralwidget);
vlPrabhuadaMain->setObjectName(QString::fromUtf8("vlPrabhuadaMain"));
vlDictionary = new QVBoxLayout();
Incorrect code generation! The QToolBar::allowedAreas property is not editable in the "Property Editor". It shows an empty line and nothing can be changed! It slows down the work very much!
3. A special button at the top "Lay Out Vertically" helped.
4. You can make a special button yourself with something like this code
Code: Select all
if ( QWhatsThis::inWhatsThisMode() )
QWhatsThis::leaveWhatsThisMode();
else
QWhatsThis::enterWhatsThisMode();
Thank you!
With best regards, Navavdvipa Chandra das.