Имеется Qt::FramelessWindowHint
-окно. Каким образом можно сделать фон на панели вкладок(см. выделенное желтым на скрине) прозрачным, чтобы было красиво? То есть, чтобы всё осталось как было, только область, выделенная желтым стала прозрачной.
-
Такое уже спрашивали на SO– free_ze1 сен 2016 в 8:30
Добавить комментарий
|
1 ответ
попробуйте setAttribute(Qt::WA_TranslucentBackground);
#include <QTableWidget>
class Widget : public QTabWidget{
public:
Widget(QWidget *parent = 0):
QTabWidget(parent)
{
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
addTab(new QWidget(this), "Tab");
}
};
-
А как можно вернуть всё как было после установки этих флагов? Пробовал писать
setAttribute(Qt::WA_TranslucentBackground, false); setWindowFlags(Qt::Widget);
, но фон становится черным.– LNK1 сен 2016 в 14:44 -
1@LNK, в справке написано: Indicates that the widget should have a translucent background, i.e., any non-opaque regions of the widgets will be translucent because the widget will have an alpha channel. Setting this flag causes WA_NoSystemBackground to be set. On Windows the widget also needs the Qt::FramelessWindowHint window flag to be set. This flag is set or cleared by the widget's author. Попробуйте
setAttribute(Qt::WA_NoSystemBackground, false);
1 сен 2016 в 15:37 -