mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Project properties dialog launch a little more faster (especially on windows)
Instead of build machine_info class which take time, only to get the max width and height of screens, call of methods Machine_info::i_max_screen_width() and Machine_info::i_max_screen_height() are now static and compute only this. The project properties dialog is now faster because don't wait the end build of machine_info.
This commit is contained in:
parent
6cf79e6e75
commit
1b6cf7d5f3
@ -27,7 +27,6 @@
|
|||||||
@param parent QWidget parent
|
@param parent QWidget parent
|
||||||
*/
|
*/
|
||||||
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
||||||
Machine_info *mymachineinfo= new Machine_info(this);
|
|
||||||
//ScrollArea for low screens
|
//ScrollArea for low screens
|
||||||
QScrollArea *scroll = new QScrollArea(this);
|
QScrollArea *scroll = new QScrollArea(this);
|
||||||
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
@ -36,7 +35,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
|||||||
// liste des pages
|
// liste des pages
|
||||||
pages_list = new QListWidget();
|
pages_list = new QListWidget();
|
||||||
pages_list -> setViewMode(QListView::IconMode);
|
pages_list -> setViewMode(QListView::IconMode);
|
||||||
if(mymachineinfo->i_max_screen_height()<1000){
|
if(Machine_info::i_max_screen_height()<1000){
|
||||||
pages_list -> setIconSize(QSize(64, 64));
|
pages_list -> setIconSize(QSize(64, 64));
|
||||||
} else {
|
} else {
|
||||||
pages_list -> setIconSize(QSize(128, 128));
|
pages_list -> setIconSize(QSize(128, 128));
|
||||||
@ -80,8 +79,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
|||||||
connect(pages_list, SIGNAL(currentRowChanged(int)),
|
connect(pages_list, SIGNAL(currentRowChanged(int)),
|
||||||
pages_widget, SLOT(setCurrentIndex(int)));
|
pages_widget, SLOT(setCurrentIndex(int)));
|
||||||
|
|
||||||
setMaximumSize(mymachineinfo->i_max_screen_width(),
|
setMaximumSize(Machine_info::i_max_screen_width(), Machine_info::i_max_screen_height());
|
||||||
mymachineinfo->i_max_screen_height());
|
|
||||||
resize(1400,1000);
|
resize(1400,1000);
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
@ -322,7 +322,22 @@ void Machine_info::init_get_cpu_info_macos()
|
|||||||
*/
|
*/
|
||||||
int32_t Machine_info::i_max_screen_width()
|
int32_t Machine_info::i_max_screen_width()
|
||||||
{
|
{
|
||||||
return pc.screen.Max_width;
|
const auto screens = qApp->screens();
|
||||||
|
auto screen_count = screens.count();
|
||||||
|
|
||||||
|
int32_t width_[10];
|
||||||
|
int32_t Max_width = 0;
|
||||||
|
|
||||||
|
for (int ii = 0; ii < screen_count; ++ii)
|
||||||
|
{
|
||||||
|
width_[ii]=
|
||||||
|
screens[ii]->geometry().width()
|
||||||
|
* screens[ii]->devicePixelRatio();
|
||||||
|
if(Max_width < width_[ii])
|
||||||
|
Max_width = width_[ii];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Max_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -330,8 +345,23 @@ int32_t Machine_info::i_max_screen_width()
|
|||||||
@return max screen height
|
@return max screen height
|
||||||
*/
|
*/
|
||||||
int32_t Machine_info::i_max_screen_height()
|
int32_t Machine_info::i_max_screen_height()
|
||||||
{
|
{
|
||||||
return pc.screen.Max_height;
|
const auto screens = qApp->screens();
|
||||||
|
auto screen_count = screens.count();
|
||||||
|
|
||||||
|
int32_t height_[10];
|
||||||
|
int32_t Max_height = 0;
|
||||||
|
|
||||||
|
for (int ii = 0; ii < screen_count; ++ii)
|
||||||
|
{
|
||||||
|
height_[ii]=
|
||||||
|
screens[ii]->geometry().height()
|
||||||
|
* screens[ii]->devicePixelRatio();
|
||||||
|
if(Max_height<height_[ii])
|
||||||
|
Max_height = height_[ii];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Max_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,8 +30,8 @@ class Machine_info : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Machine_info(QObject *parent = nullptr);
|
explicit Machine_info(QObject *parent = nullptr);
|
||||||
int32_t i_max_screen_width();
|
static int32_t i_max_screen_width();
|
||||||
int32_t i_max_screen_height();
|
static int32_t i_max_screen_height();
|
||||||
QString compilation_info();
|
QString compilation_info();
|
||||||
void send_info_to_debug();
|
void send_info_to_debug();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user