I recently upgraded to Qt 4.4.1, and after compiling my program and running it, I noticed that when the first modal dialog, a login popup appears, it does not allow me to click on any of the buttons in it anymore. In addition, I can not drag the login popup around like I normally should be able to. I broke down the code to a simple example, and the same exact thing happens: the dialog will appear, but I can not click on any of the buttons or fields in it. Here is the code for the simple example that has this problem:
Main.cpp:
#include <QApplication>
#include "calculatorform.h"
int main(int argc, char *argv[]) {
//show the main window:
FabwareMain calculator;
calculator.show();
return app.exec();
}
#include <QApplication>
#include "calculatorform.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
//show the main window:
FabwareMain calculator;
calculator.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Calculatorform.h:
#ifndef CALCULATORFORM_H
#define CALCULATORFORM_H
//user interface for this window:
#include "ui_calculatorform.h"
//dialogs that are spawned from this window:
#include "dialog_login.h"
#include "var_login.h"
//QT modules used by this window:
#include <QString>
Q_OBJECT
public:
FabwareMain();
private slots:
void popupLogin();
private:
//interface:
Ui::FabwareMain ui;
//variables:
var_login login; //stores last login information
};
#endif
#ifndef CALCULATORFORM_H
#define CALCULATORFORM_H
//user interface for this window:
#include "ui_calculatorform.h"
//dialogs that are spawned from this window:
#include "dialog_login.h"
#include "var_login.h"
//QT modules used by this window:
#include <QString>
class FabwareMain : public QMainWindow {
Q_OBJECT
public:
FabwareMain();
private slots:
void popupLogin();
private:
//interface:
Ui::FabwareMain ui;
//variables:
var_login login; //stores last login information
};
#endif
To copy to clipboard, switch view to plain text mode
Calculatorform.cpp:
#include <QtGui>
#include "calculatorform.h"
#include <QMessageBox>
#include <QDebug>
/*
Constructor for main window:
*/
FabwareMain::FabwareMain() {
ui.setupUi(this);
connect( ui.actionLogin, SIGNAL( triggered() ), this, SLOT( popupLogin() ) );
}
//popup for login dialog:
void FabwareMain::popupLogin() {
//create a dialog box:
DialogLogin dlg(this);
//do something once we click OK:
if( dlg.
exec() == QDialog::Accepted ) { login = dlg.login;
}
}
#include <QtGui>
#include "calculatorform.h"
#include <QMessageBox>
#include <QDebug>
/*
Constructor for main window:
*/
FabwareMain::FabwareMain() {
ui.setupUi(this);
connect( ui.actionLogin, SIGNAL( triggered() ), this, SLOT( popupLogin() ) );
}
//popup for login dialog:
void FabwareMain::popupLogin() {
//create a dialog box:
DialogLogin dlg(this);
//do something once we click OK:
if( dlg.exec() == QDialog::Accepted ) {
login = dlg.login;
}
}
To copy to clipboard, switch view to plain text mode
Dialog_login.h
#ifndef DIALOG_LOGIN_H
#define DIALOG_LOGIN_H
//user interface items:
#include "ui_dialog_login.h"
//data structure items:
#include "var_login.h"
class DialogLogin
: public QDialog,
private Ui
::DialogLogin {
Q_OBJECT
public:
//functions:
//variables:
var_login login;
private slots:
void returnVars();
private:
};
#endif
#ifndef DIALOG_LOGIN_H
#define DIALOG_LOGIN_H
//user interface items:
#include "ui_dialog_login.h"
//data structure items:
#include "var_login.h"
class DialogLogin : public QDialog, private Ui::DialogLogin {
Q_OBJECT
public:
//functions:
DialogLogin(QWidget *parent = 0);
//variables:
var_login login;
private slots:
void returnVars();
private:
};
#endif
To copy to clipboard, switch view to plain text mode
dialog_login.cpp:
#include <QtGui>
#include "dialog_login.h"
//setup interface of main window:
setupUi(this);
//connect form item signals to slots that arent in the UI file here:
connect(buttonBox, SIGNAL(accepted()), this, SLOT(returnVars()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
void DialogLogin::returnVars() {
login.username = userid->text();
login.password = password->text();
accept();
}
#include <QtGui>
#include "dialog_login.h"
//setup interface of main window:
DialogLogin::DialogLogin(QWidget *parent) : QDialog(parent) {
setupUi(this);
//connect form item signals to slots that arent in the UI file here:
connect(buttonBox, SIGNAL(accepted()), this, SLOT(returnVars()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
void DialogLogin::returnVars() {
login.username = userid->text();
login.password = password->text();
accept();
}
To copy to clipboard, switch view to plain text mode
var_login.h:
#ifndef VAR_LOGIN_H
#define VAR_LOGIN_H
#include <QString>
class var_login {
public:
password;
};
#endif
#ifndef VAR_LOGIN_H
#define VAR_LOGIN_H
#include <QString>
class var_login {
public:
QString username,
password;
};
#endif
To copy to clipboard, switch view to plain text mode
Bookmarks