#define KEYPAD_WIDTH 200
#define KEYPAD_HEIGHT 700
#define LOGWINDOW_HEIGHT 80
#define MIN_WIDTH_FACTOR 240
#define MIN_HEIGHT_FACTOR 100
MainWindow
::MainWindow(QWidget *parent
){
int x_c, y_c, screen_width,screen_height;
int display_window_width,display_window_height;
QRect rect
= D
->geometry
();
rect.getRect(&x_c,&y_c,&screen_width,&screen_height);
qDebug()<<"x="<<x_c<<"y="<<y_c<<"s_w="<<screen_width<<"s_h="<<screen_height<<endl;
display_window_width = screen_width - MIN_WIDTH_FACTOR - KEYPAD_WIDTH;
display_window_height = screen_height- MIN_HEIGHT_FACTOR - LOGWINDOW_HEIGHT;
setMinimumSize(screen_width - MIN_WIDTH_FACTOR,screen_height-MIN_HEIGHT_FACTOR);
setMaximumSize(screen_width, screen_height);
//setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
ServerWin->setMinimumSize(screen_width - MIN_WIDTH_FACTOR,screen_height-MIN_HEIGHT_FACTOR);
ServerWin->setMaximumSize(screen_width, screen_height);
setCentralWidget(ServerWin);
setAutoFillBackground(true);
MainWin->setAutoFillBackground(true);
Dlayout->addWidget(DispWin);
DispWin->setAutoFillBackground(true);
Dlayout->setSpacing(1);
DispWin->setMinimumSize(display_window_width,display_window_height);
Dlayout->addWidget(LogWin);
LogWin->setAutoFillBackground(true);
LogWin->setMinimumSize(display_window_width,LOGWINDOW_HEIGHT);
MainWin->setLayout(Dlayout);
KeyWin->setAutoFillBackground(true);
//QWidget* keypad = new QWidget;
//QHBoxLayout *vLay = new QHBoxLayout;
//keypad->setLayout(vLay);
//KeyWin->setFixedSize(KEYPAD_WIDTH,KEYPAD_HEIGHT+20);
//KeyWin->setFixedSize(KEYPAD_WIDTH,(display_window_height+LOGWINDOW_HEIGHT/*+MIN_HEIGHT_FACTOR*/));
//KeyWin->setFixedSize(KEYPAD_WIDTH,display_window_height+LOGWINDOW_HEIGHT /*(screen_height-MIN_HEIGHT_FACTOR+display_window_height-100)*/);
KeyWin->setFixedSize(KEYPAD_WIDTH,DispWin->height()+LogWin->height() /*(screen_height-MIN_HEIGHT_FACTOR+display_window_height-100)*/);
//KeyWin->setMinimumSize(KEYPAD_WIDTH,(screen_height-MIN_HEIGHT_FACTOR));
//vLay->addWidget(KeyWin);
vLay->setContentsMargins(0,0,0,0);
Mlayout->addWidget(MainWin);
Mlayout->setSpacing(1);
Mlayout->addWidget(KeyWin);
ServerWin->setLayout(Mlayout);
}
#define KEYPAD_WIDTH 200
#define KEYPAD_HEIGHT 700
#define LOGWINDOW_HEIGHT 80
#define MIN_WIDTH_FACTOR 240
#define MIN_HEIGHT_FACTOR 100
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
int x_c, y_c, screen_width,screen_height;
int display_window_width,display_window_height;
ServerWin = new QWidget;
MainWin = new QWidget;
DispWin = new QWidget;
LogWin = new QWidget;
KeyWin = new QWidget;
QHBoxLayout *Mlayout = new QHBoxLayout;
QVBoxLayout *Dlayout = new QVBoxLayout;
QDesktopWidget *D = new QDesktopWidget;
QRect rect = D->geometry();
rect.getRect(&x_c,&y_c,&screen_width,&screen_height);
qDebug()<<"x="<<x_c<<"y="<<y_c<<"s_w="<<screen_width<<"s_h="<<screen_height<<endl;
display_window_width = screen_width - MIN_WIDTH_FACTOR - KEYPAD_WIDTH;
display_window_height = screen_height- MIN_HEIGHT_FACTOR - LOGWINDOW_HEIGHT;
setMinimumSize(screen_width - MIN_WIDTH_FACTOR,screen_height-MIN_HEIGHT_FACTOR);
setMaximumSize(screen_width, screen_height);
//setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
ServerWin->setMinimumSize(screen_width - MIN_WIDTH_FACTOR,screen_height-MIN_HEIGHT_FACTOR);
ServerWin->setMaximumSize(screen_width, screen_height);
setCentralWidget(ServerWin);
ServerWin->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
setPalette(QPalette(QColor(0,0,128,255)));//Navy Blue
setAutoFillBackground(true);
MainWin->setPalette(QPalette(QColor(0,255,255,255)));//Cyan
MainWin->setAutoFillBackground(true);
Dlayout->addWidget(DispWin);
DispWin->setPalette(QPalette(QColor( 230,230,250,255)));//Lavender
DispWin->setAutoFillBackground(true);
Dlayout->setSpacing(1);
DispWin->setMinimumSize(display_window_width,display_window_height);
Dlayout->addWidget(LogWin);
LogWin->setPalette(QPalette(QColor(148,0,211,255)));//Dark Violet
LogWin->setAutoFillBackground(true);
LogWin->setMinimumSize(display_window_width,LOGWINDOW_HEIGHT);
MainWin->setLayout(Dlayout);
KeyWin->setPalette(QPalette(QColor( 238,130,238,255)));//Violet
KeyWin->setAutoFillBackground(true);
//QWidget* keypad = new QWidget;
//QHBoxLayout *vLay = new QHBoxLayout;
//keypad->setLayout(vLay);
//KeyWin->setFixedSize(KEYPAD_WIDTH,KEYPAD_HEIGHT+20);
//KeyWin->setFixedSize(KEYPAD_WIDTH,(display_window_height+LOGWINDOW_HEIGHT/*+MIN_HEIGHT_FACTOR*/));
//KeyWin->setFixedSize(KEYPAD_WIDTH,display_window_height+LOGWINDOW_HEIGHT /*(screen_height-MIN_HEIGHT_FACTOR+display_window_height-100)*/);
KeyWin->setFixedSize(KEYPAD_WIDTH,DispWin->height()+LogWin->height() /*(screen_height-MIN_HEIGHT_FACTOR+display_window_height-100)*/);
//KeyWin->setMinimumSize(KEYPAD_WIDTH,(screen_height-MIN_HEIGHT_FACTOR));
//vLay->addWidget(KeyWin);
vLay->setContentsMargins(0,0,0,0);
Mlayout->addWidget(MainWin);
Mlayout->setSpacing(1);
Mlayout->addWidget(KeyWin);
ServerWin->setLayout(Mlayout);
}
To copy to clipboard, switch view to plain text mode
Bookmarks