The Following User Says Thank You to Diph For This Useful Post: | ||
![]() |
2010-09-22
, 11:17
|
|
Posts: 2,154 |
Thanked: 2,186 times |
Joined on Dec 2009
@ Hellsinki, Finland
|
#112
|
You can use member variable to access variables in other method.
MainWindow.h
MainWindow.cppCode:class MainWindow { ... private: QStringList fonts; }
Maybe change the method name to be more descriptiveCode:MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), progress("Setting up the theme, please wait...", "Abort", 0, 0, this), colors() { ui->setupUi(this); ui->scrollArea->setWidget(ui->widget); readdirs(); QString oldfont1 = ui->font1->text(); QString oldfont2 = ui->font2->text(); QString oldfont3 = ui->font3->text(); QString oldfont4 = ui->font4->text(); fonts.append(oldfont1); fonts.append(oldfont2); fonts.append(oldfont3); fonts.append(oldfont4); // readSettings(); }
Code:void MainWindow::on_pushButton_clicked() { fonts.at(0); //do something to oldfont1 string }
![]() |
2010-09-22
, 11:33
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#113
|
Now I'm strugling with QColorDialog which seems to be buggy (don't know if it's my or Qt's fault); colors shown on the palette arent matching to the actual selected color (color shown at the box on the right). You can see on the screenshot attached that on the left box I'm choosing a green color and on the right box orange is shown (and selected).
![]() |
2010-09-22
, 12:03
|
|
Posts: 2,154 |
Thanked: 2,186 times |
Joined on Dec 2009
@ Hellsinki, Finland
|
#114
|
http://bugreports.qt.nokia.com/browse/QTBUG-11788
Not your fault :-)
Nicolai
![]() |
2010-09-22
, 12:23
|
|
Posts: 1,023 |
Thanked: 4,421 times |
Joined on Feb 2010
@ Argentina
|
#115
|
![]() |
2010-09-22
, 12:59
|
|
Posts: 2,154 |
Thanked: 2,186 times |
Joined on Dec 2009
@ Hellsinki, Finland
|
#116
|
It's ibqt4-experimental and it's in the repositories (don't know if it's in tresting, but I'mshure its in devel).
The following packages have unmet dependencies: libqt4-experimental-dev: Depends: libgles2-sgx-img-dev but it is not installable Depends: opengles-sgx-img-common-dev but it is not installable Depends: libsqlite3-dev but it is not installable
![]() |
2010-09-22
, 15:13
|
Posts: 180 |
Thanked: 76 times |
Joined on May 2010
|
#117
|
![]() |
2010-09-22
, 17:24
|
|
Posts: 2,154 |
Thanked: 2,186 times |
Joined on Dec 2009
@ Hellsinki, Finland
|
#118
|
Are you sure you didn't install any other library than core and you compiled the app with Qt 4.7? I thought your app would at least need core and gui...
![]() |
2010-09-23
, 10:47
|
|
Posts: 2,154 |
Thanked: 2,186 times |
Joined on Dec 2009
@ Hellsinki, Finland
|
#119
|
Store the items in QHash. Then you can access items by key: QHash::value(const Key & key)
Code:QFile file(/etc/hildon/theme/colors.config); if (!file.open (IO_ReadOnly)) // didn't work QTextStream stream ( &file ); QString line; QHash<QString, QString> variables; while( !stream.eof() ) { line = stream.readLine(); //Split QStringList splittedLine = line.split("="); //Maybe add some checks here (splittedLine.count == 2 etc.) variables.insert(splittedLine.at(0), splittedLine.at(1)); } file.close();
QFile file("/etc/hildon/theme/colors.config"); if (!file.open (IO_ReadOnly)) // didn't work QTextStream stream ( &file ); QString line; QHash<QString, QString> variables; while( !stream.eof() ) { line = stream.readLine(); //Split QStringList splittedLine = line.split("="); //Maybe add some checks here (splittedLine.count == 2 etc.) variables.insert(splittedLine.at(0), splittedLine.at(1)); } file.close(); QString oldfont1 = variables.value(key.DefaultTextColor());
![]() |
2010-09-23
, 10:55
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#120
|
And build errors I get are:
'IO_ReadOnly' was not declared in this cope
MainWindow.h