[SOLVED] QSS File Changing MainWindow size from Maximised
-
Quick question I have a QSS file that i use to set the style and this works great. However I seem to be getting a weird problem.
When I launch the program I tell it to start in fullscreen but instead the program launches as a small window with
@
GUIForm lGUIForm(aFullscreen, fOwner,aConfiguration); if (aFullscreen) { lGUIForm.showMaximized(); } else { lGUIForm.show(); }
if (!loadQTStylesheet())
{
LOG_WARN << "Stylesheet load failed. Using default display";
}
return fApplication.exec()
@Below is my stylesheet
@QDialog
{
background-color: #3A3A53;
font-family: "DejaVu Sans";
}#MAINFRM
{
background-color: #3A3A53;
font-family: "DejaVu Sans";
}#HEADER
{
background-color: rgb(12, 12, 40);
color: rgb(255, 255, 255);
font-family: "DejaVu Sans";
}#MENUBAR
{
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffffff, stop: 1 #c2c2d4);
}#FILTERBAR
{
background-color: rgb(58, 58, 83);
}#VIDEOFRM
{
background-color: rgb(0, 0, 0);
}#ALARMBAR
{
background-color: rgb(35, 35, 61);
color: rgb(255, 255, 255);
}#MSGBOX
{
background-color: #141428;
font-family: "DejaVu Sans";
color: #D9D9EA;
border: 0px solid #9595A9;
padding: 0 10px 0 10px;
}#IndicationPanel
{
font-family: "DejaVu Sans" ;
background-color: #3C3C79 ;
border-color: #67677E ;
color: #67677E ;
border-style: solid ;
border-width: 2px ;
border-radius: 4px ;
}QLabel
{
background-color: #3A3A53;
font-family: "DejaVu Sans";
color: #D9D9EA;
}QPushButton:hover:pressed{
font-family: "DejaVu Sans";
background-color: #3F3FB3 ;
border-color: #F0F0FF ;
color: #F0F0FF ;
border-style: solid;
border-width: 2px;
border-radius: 4px;
}
QPushButton:hover:!pressed {
font-family: "DejaVu Sans";
background-color: #D9D9EA ;
border-color: #000000 ;
color: #3A3A53 ;
border-style: solid;
border-width: 2px;
border-radius: 4px;
}
QPushButton:!hover {
font-family: "DejaVu Sans";
background-color: #D9D9EA ;
border-color: #000000 ;
color: #3A3A3A ;
border-style: solid;
border-width: 2px;
border-radius: 4px;
}
QPushButton:disabled{
background-color: #9595A9;
border-color: #67677E;
color: #67677E;
font-family: "DejaVu Sans";
border-style: solid;
}
QPushButton:disabled:pressed{
background-color: #3C3C79;
border-color: #67677E;
color: #67677E;
font-family: "DejaVu Sans";
border-style: solid;
}@The weird thing is I know it's to do with the stylesheet as if i stop it from being loaded the program launches in fullscreen. Has anyone seen this or have any solution how to solve this that would be great.
-
Well I have nailed down the problem to 3 lines in the stylesheet if i put either in the code the window will always open to the smaller size (but you can see the window first tries to go full screen then is quickly changed).
The 3 problem lines are as follows:
font-family: "DejaVu Sans";
font: bold 14px;border-style: solid;
If anyone has a solution to this that would be great as quite frankly losing my mind, can anything in my code effect the QSS file?
-
Hi,
Something's not clear, since you want to show your dialog in full screen, why not call showFullScreen ?
-
Sorry SGaist,
Meant to say Maximised, what's happening is it tries to go maximised(as that is first in the code), then it loads the stylesheet. When it loads the Qt stylesheet it shrinks it, if i remove the loading of the stylesheet, i obviously have no style to anything but the window is maximised. Any ideas what I could be doing wrong? I don't understand why removing fonts and border-style from my stylesheet will allow it to work. -
Fixed the problem it's related to order of the code. Specifically show maximised must be run before loading the qt stylesheet, otherwise strange problems with the style sheet will occur. Once I changed the code to load the stylesheet first the code began working again.