QListWidget + setWindowFlags = bad scrollbar
I create a modal gui just to show a list with a QListWidget.
This is the class:
Code:
class CShowRolesModalGui
: public QDialog{
Q_OBJECT
public:
CShowRolesModalGui
(const QStringList
& items,
QWidget* parent
);
private slots:
void Close () { done(0); }
};
and this is the code:
Code:
CShowRolesModalGui
::CShowRolesModalGui(const QStringList
& items,
QWidget* parent
) : QDialog(parent
){
setFixedSize(400, 300);
setStyleSheet(ROLES_WIDGET_STYLE);
setWindowFlags(Qt::FramelessWindowHint);
listView->setGeometry(2, 2, 396, 260);
listView->setStyleSheet(LIST_SHOW_ROLE_STYLE);
listView->addItems(items);
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 ...
Re: QListWidget + setWindowFlags = bad scrollbar
can you attach minimal compilable example which reproduces the problem?
Re: QListWidget + setWindowFlags = bad scrollbar
I'd start by using layouts in your program. Next I'd try if removing the style sheet fixes the problem.
Re: QListWidget + setWindowFlags = bad scrollbar
Quote:
Originally Posted by
trallallero
background-color: rgb(200, 200, 200);
Should you try this string:
Code:
background-color: #C8C8C8;
?
Re: QListWidget + setWindowFlags = bad scrollbar
You should probably style the scrollbar's groove as well.