diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-01-27 10:49:35 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-02-03 11:40:00 +0100 |
commit | 0d36e0d0e1374517bd196c74b0f148abfaf1a58a (patch) | |
tree | 8b5d1bbd840b7b3c6b1b2f606fb9926d65df4062 /examples/designer/taskmenuextension/tictactoedialog.cpp | |
parent | 4a49f40ad8bd56962cc9efea6439a4f9b6ffb9f7 (diff) |
Brush up the taskmenuextension example
When porting the code to Python, some issues showed up.
- Rewrite cellRect() to take the position (reason being
that porting the existing code to Python creates
problems with implicit conversion to float in the division).
- Use plain assignment by operator[] to replace the characters
in the string
- Avoid repeating return types.
- Streamline code.
- Initialize myState member variable.
- Indicate C++ in the tool tip
Task-number: PYSIDE-1455
Change-Id: I62fa61eebaa2eefe8db0842d6a3789bd7cd4257e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'examples/designer/taskmenuextension/tictactoedialog.cpp')
-rw-r--r-- | examples/designer/taskmenuextension/tictactoedialog.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/examples/designer/taskmenuextension/tictactoedialog.cpp b/examples/designer/taskmenuextension/tictactoedialog.cpp index 8b62064f8..a13b093d2 100644 --- a/examples/designer/taskmenuextension/tictactoedialog.cpp +++ b/examples/designer/taskmenuextension/tictactoedialog.cpp @@ -74,11 +74,10 @@ TicTacToeDialog::TicTacToeDialog(TicTacToe *tic, QWidget *parent) connect(buttonBox, &QDialogButtonBox::accepted, this, &TicTacToeDialog::saveState); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - QVBoxLayout *mainLayout = new QVBoxLayout; + QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(editor); mainLayout->addWidget(buttonBox); - setLayout(mainLayout); setWindowTitle(tr("Edit State")); } //! [0] |