trallallero
9th December 2009, 08:21
I create a modal gui just to show a list with a QListWidget.
This is the class:
class CShowRolesModalGui : public QDialog
{
Q_OBJECT
public:
CShowRolesModalGui(const QStringList& items, QWidget* parent);
private slots:
void Close () { done(0); }
};
and this is the code:
CShowRolesModalGui::CShowRolesModalGui(const QStringList& items, QWidget* parent) : QDialog(parent)
{
setGeometry(QRect(QPoint(205, 430), QSize(400, 300)));
setFixedSize(400, 300);
setStyleSheet(ROLES_WIDGET_STYLE);
setWindowFlags(Qt::FramelessWindowHint);
QListWidget* listView = new QListWidget(this);
listView->setGeometry(2, 2, 396, 260);
listView->setStyleSheet(LIST_SHOW_ROLE_STYLE);
listView->addItems(items);
QPushButton* btn = new QPushButton(tr("Ok"), this);
btn->setGeometry(175, 265, 50, 30);
btn->setStyleSheet(FREQ_MODAL_BTN_STYLE);
connect(btn, SIGNAL(clicked()), this, SLOT(Close()));
}
If I call the function setWindowFlags (and I have to call it as I don't want a gui with a border), the QListWidget's scrollbar is visible but doesn't work with the mouse buttons, only with the wheel and the keyboard.
How can I solve the problem ? I really need a GUI without a border.
Thanks.
PS: I doesn't work also with:
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
setWindowFlags(Qt::FramelessWindowHint);
setWindowFlags(Qt::CustomizeWindowHint);
and so on ...
This is the class:
class CShowRolesModalGui : public QDialog
{
Q_OBJECT
public:
CShowRolesModalGui(const QStringList& items, QWidget* parent);
private slots:
void Close () { done(0); }
};
and this is the code:
CShowRolesModalGui::CShowRolesModalGui(const QStringList& items, QWidget* parent) : QDialog(parent)
{
setGeometry(QRect(QPoint(205, 430), QSize(400, 300)));
setFixedSize(400, 300);
setStyleSheet(ROLES_WIDGET_STYLE);
setWindowFlags(Qt::FramelessWindowHint);
QListWidget* listView = new QListWidget(this);
listView->setGeometry(2, 2, 396, 260);
listView->setStyleSheet(LIST_SHOW_ROLE_STYLE);
listView->addItems(items);
QPushButton* btn = new QPushButton(tr("Ok"), this);
btn->setGeometry(175, 265, 50, 30);
btn->setStyleSheet(FREQ_MODAL_BTN_STYLE);
connect(btn, SIGNAL(clicked()), this, SLOT(Close()));
}
If I call the function setWindowFlags (and I have to call it as I don't want a gui with a border), the QListWidget's scrollbar is visible but doesn't work with the mouse buttons, only with the wheel and the keyboard.
How can I solve the problem ? I really need a GUI without a border.
Thanks.
PS: I doesn't work also with:
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
setWindowFlags(Qt::FramelessWindowHint);
setWindowFlags(Qt::CustomizeWindowHint);
and so on ...