case 0:
if i do not use any setCurrentItem function in the QTreeWidget,all the item are normal
str1.append("uistyle.css");
if(file.
open(QFile::ReadOnly)) {
a.setStyleSheet(styleSheet);
file.close();
}
MainWindow w;
w.show();
return a.exec();
QApplication a(argc, argv);
QString str1;
str1.append("uistyle.css");
QFile file(str1);
if(file.open(QFile::ReadOnly))
{
QString styleSheet = QObject::tr(file.readAll());
a.setStyleSheet(styleSheet);
file.close();
}
MainWindow w;
w.show();
return a.exec();
To copy to clipboard, switch view to plain text mode
ui->setupUi(this);
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(0));
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(1));
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(2));
ui->setupUi(this);
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(0));
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(1));
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(2));
To copy to clipboard, switch view to plain text mode
case 1:
in the main function i have used the setStyleSheet and use it before the mainwindow's construct function
if i use
ui->setupUi(this);
ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(0));
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(1));
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(2));
ui->setupUi(this);
ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(0));
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(1));
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(2));
To copy to clipboard, switch view to plain text mode
the first and the last item height are UNNormal but the second and the third is NORMAL
all the sub items are normal
case 2:
in the main function i have used the setStyleSheet and use it before the mainwindow's construct function
ui->setupUi(this);
ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(0));
ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(1));
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(2));
ui->setupUi(this);
ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(0));
ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(1));
//ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(2));
To copy to clipboard, switch view to plain text mode
the first the second and the last item height are UNNormal but the third is NORMAL
all the sub items are normal
case 3
i change the order of mainwindow's construct function and the setStyleSheet func
MainWindow w; //to here
str1.append("uistyle.css");
if(file.
open(QFile::ReadOnly)) {
a.setStyleSheet(styleSheet);
file.close();
}
//MainWindow w; //old position
w.show();
return a.exec();
QApplication a(argc, argv);
MainWindow w; //to here
QString str1;
str1.append("uistyle.css");
QFile file(str1);
if(file.open(QFile::ReadOnly))
{
QString styleSheet = QObject::tr(file.readAll());
a.setStyleSheet(styleSheet);
file.close();
}
//MainWindow w; //old position
w.show();
return a.exec();
To copy to clipboard, switch view to plain text mode
all the item are normal
why? the attachment is follow
Bookmarks