X-Git-Url: https://vaikene.ee/gitweb/highlight.css?a=blobdiff_plain;ds=sidebyside;f=www%2Fpswgen10.html;h=bef0c7b1c9a3e7f610c72ca1520aed17446e89e4;hb=60aebc188674bbfb67be51958ec33171c72986b9;hp=f1ea8e16ba98cfb15d27661c20f849ef8bfffe17;hpb=30c0930d760d6338dba3982e01125b10f84c47b2;p=evaf diff --git a/www/pswgen10.html b/www/pswgen10.html index f1ea8e1..bef0c7b 100644 --- a/www/pswgen10.html +++ b/www/pswgen10.html @@ -12,6 +12,8 @@
+ +Next: 11 - Building GUI Module, Previous: 09 - GUI Module
The main window has an empty QVBoxLayout layout and we could add our widgets directly to this layout, but for keyboard + shortcuts to work properly, we need a widget that fills the main window. We create a master widget, add it to the main window + layout and then fill the master widget with other widgets.
+bool Module::init(QString const & args) { Q_UNUSED(args); @@ -132,12 +138,15 @@ Module::~Moduleif (!mStorage) EVAF_WARNING("No iStorage interface"); - // Get the main window interface and fill it with widgets + // Get the main window interface and fill it with the widgets SdiWindow::iSdiWindow * win = evafQueryInterface<SdiWindow::iSdiWindow>("iSdiWindow"); EVAF_TEST_X(win, "No iSdiWindow interface"); + QWidget * masterWidget = new QWidget; + win->addWidget(masterWidget); + QVBoxLayout * v = new QVBoxLayout; - win->widget()->setLayout(v); + masterWidget->setLayout(v); QGridLayout * g = new QGridLayout; v->addLayout(g); @@ -167,7 +176,7 @@ Module::~Module} connect(wName, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); g->addWidget(wName, 1, 1, 1, 2); - win->widget()->setFocusProxy(wName); + masterWidget->setFocusProxy(wName); l = new QLabel(tr("&Length of the password:", VER_MODULE_NAME_STR)); l->setAlignment(Qt::AlignRight); @@ -205,15 +214,15 @@ Module::~Moduleconnect(wCopy, SIGNAL(clicked()), this, SLOT(copyClicked())); h->addWidget(wCopy); - QAction * a = new QAction(win->widget()); + QAction * a = new QAction(masterWidget); a->setShortcut(Qt::Key_Return); connect(a, SIGNAL(triggered()), this, SLOT(generateClicked())); - win->widget()->addAction(a); + masterWidget->addAction(a); - a = new QAction(win->widget()); + a = new QAction(masterWidget); a->setShortcut(Qt::Key_Escape); connect(a, SIGNAL(triggered()), qApp, SLOT(quit())); - win->widget()->addAction(a); + masterWidget->addAction(a); mReady = true; @@ -340,8 +349,11 @@ Module::~Module::iSdiWindow * win = evafQueryInterface<SdiWindow::iSdiWindow>("iSdiWindow"); EVAF_TEST_X(win, "No iSdiWindow interface"); + QWidget * masterWidget = new QWidget; + win->addWidget(masterWidget); + QVBoxLayout * v = new QVBoxLayout; - win->widget()->setLayout(v); + masterWidget->setLayout(v); QGridLayout * g = new QGridLayout; v->addLayout(g); @@ -371,7 +383,7 @@ Module::~Module} connect(wName, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); g->addWidget(wName, 1, 1, 1, 2); - win->widget()->setFocusProxy(wName); + masterWidget->setFocusProxy(wName); l = new QLabel(tr("&Length of the password:", VER_MODULE_NAME_STR)); l->setAlignment(Qt::AlignRight); @@ -409,15 +421,15 @@ Module::~Moduleconnect(wCopy, SIGNAL(clicked()), this, SLOT(copyClicked())); h->addWidget(wCopy); - QAction * a = new QAction(win->widget()); + QAction * a = new QAction(masterWidget); a->setShortcut(Qt::Key_Return); connect(a, SIGNAL(triggered()), this, SLOT(generateClicked())); - win->widget()->addAction(a); + masterWidget->addAction(a); - a = new QAction(win->widget()); + a = new QAction(masterWidget); a->setShortcut(Qt::Key_Escape); connect(a, SIGNAL(triggered()), qApp, SLOT(quit())); - win->widget()->addAction(a); + masterWidget->addAction(a); mReady = true;