Skip to content

Commit

Permalink
feature: update ui
Browse files Browse the repository at this point in the history
  • Loading branch information
QQxiaoming committed Jun 17, 2020
1 parent 2664137 commit 185b37f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
22 changes: 14 additions & 8 deletions src/YUVviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ YUVviewer::YUVviewer(QWidget *parent) :
QRect size = this->geometry();
this->move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2);

ui->frameSizeType_ComboBox->setStyleSheet("combobox-popup: 0;");
ui->YUVFormat_ComboBox->setStyleSheet("combobox-popup: 0;");
ui->frameRate_ComboBox->setStyleSheet("combobox-popup: 0;");

QList<QPair<QString, QStringList>>::const_iterator config_it = frameSizeTypeDict.begin();
while (config_it != frameSizeTypeDict.end()) {
ui->frameSizeType_ComboBox->insertItem(ui->frameSizeType_ComboBox->count(),config_it->first);
config_it++;
}
ui->frameSizeType_ComboBox->setStyleSheet("combobox-popup: 0;");
ui->YUVFormat_ComboBox->setStyleSheet("combobox-popup: 0;");
ui->frameRate_ComboBox->setStyleSheet("combobox-popup: 0;");

YUVviewerConfigFile = new ConfigFile(QCoreApplication::applicationDirPath()+"/YUVViewer.ini");
if(YUVviewerConfigFile->config_dict.frameSizeType == "Other")
Expand Down Expand Up @@ -519,9 +520,14 @@ void YUVviewer::closeEvent(QCloseEvent *event)

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
YUVviewer w;
w.show();

return a.exec();
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication application(argc, argv);
QFont font = application.font();
font.setFamily(font.defaultFamily());
font.setPixelSize(13);
application.setFont(font);
YUVviewer window;
window.show();

return application.exec();
}
13 changes: 9 additions & 4 deletions src/YUVviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@ def exit(self):
self.close()

if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
show = YUVviewer()
show.show()
sys.exit(app.exec_())
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling);
application = QtWidgets.QApplication(sys.argv)
font = application.font()
font.setFamily(font.defaultFamily())
font.setPixelSize(13)
application.setFont(font)
window = YUVviewer()
window.show()
sys.exit(application.exec_())

0 comments on commit 185b37f

Please sign in to comment.