Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

[Solved] using customized QPushButton on QWizard

$
0
0
Hello every one. I want to use a QPushButton on QWizardPage. I have implemented the qwizard pages and added QPushButton as follows in the code bellow. When I click the button, the signal and slot connection does not work. Any idea on how to go around it? Thanks in advance for your response. class DatabasePage : public QWizardPage {   public:     DatabasePage();       int nextId() const;   private slots:     void connectionTest();   private:     QPushButton *testConnBttn; }; DatabasePage::DatabasePage() {    .....     testConnBttn = new QPushButton(tr("Test connection"));     QHBoxLayout *bttnLayout = new QHBoxLayout;     bttnLayout->addStretch();     bttnLayout->addWidget(testConnBttn);       setLayout(bttnLayout);     connect(testConnBttn, SIGNAL(clicked()), this, SLOT(connectionTest())); } void DatabasePage::connectionTest() {     QMessageBox::information(this,"WATCH","Error");       QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");     db.setHostName( "localhost");     db.setDatabaseName( "test" );     db.setUserName( "root" );     db.setPassword( "hqo" );     if ( !db.open() )     {         QMessageBox::information(this,"WATCH",db.lastError().text());     } }

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>