qsettings

Qt - pyside - saveGeometry() saveState()

谁都会走 提交于 2020-01-02 16:01:24
问题 I have a Qt program and currently I use the Qsettings.saveGeometry() and Qsettings.saveState() functions to allow the program to restore the layout that the user set in the previous session. However not all geometry is saved, only the main window and not the children especially floating position of docked windows and table column widths within docked windows. This thread seems to attempt to provide an answer (but in C++ and not python): http://www.qtforum.org/article/38362/save-geometry-of

Qt - pyside - saveGeometry() saveState()

僤鯓⒐⒋嵵緔 提交于 2020-01-02 16:01:20
问题 I have a Qt program and currently I use the Qsettings.saveGeometry() and Qsettings.saveState() functions to allow the program to restore the layout that the user set in the previous session. However not all geometry is saved, only the main window and not the children especially floating position of docked windows and table column widths within docked windows. This thread seems to attempt to provide an answer (but in C++ and not python): http://www.qtforum.org/article/38362/save-geometry-of

Qt QSettings try to create ini file but none created why?

半腔热情 提交于 2020-01-02 04:08:16
问题 Im trying to create ini file that will hold me the configuration data, I have singletone class that setting the QSettings object like this : ... #DEFINE CONFIG_FILE_NAME "myconfig.ini" m_pSettings = new QSettings(QDir::currentPath()+"/"+CONFIG_FILE_NAME,QSettings::IniFormat); this is accourding the document, but when i look in my application dir, there is none myconfig.ini file created, what im doing wrong ? 回答1: I believe in order to force QSettings file to appear you would need to set at

How to read a value using QSetting if the value contains comma character [duplicate]

半腔热情 提交于 2020-01-01 21:57:47
问题 This question already has an answer here : QSettings::IniFormat values with “,” returned as QStringList (1 answer) Closed 5 years ago . In my QT project I am reading values from .ini file using QSettings. If the value contains comma character QSettings is not able to read it. How should I read such values? 回答1: Comma character is treated as list separator by QSettings . INI values with commas are parsed as string lists. You can convert a string list back to original string as follows:

Qt: C++: Restoring geometry of a pop-up dialog-box

旧城冷巷雨未停 提交于 2019-12-24 17:14:05
问题 I am trying to save the geometry of a pop-up dialog-box and then restore it back whenever I call the pop-up dialog box (while the application is still running). But I couldn't figure it out. The code runs without error. But the window of the pop-up keeps changing it position vertically everytime it is open. Unless I close the whole application and then re-opened it again, the pop-up never goes to its original position in the center of the screen. I am trying to use QcloseEvent , QSettings and

How to run a Qt application run at startup? [duplicate]

﹥>﹥吖頭↗ 提交于 2019-12-24 06:38:04
问题 This question already has an answer here : Closed 6 years ago . Possible Duplicate: running a qt application at startup How can I run a qt program at startup so that the user won't see the desktop at all? I am building my program in linux and I want to distribute it to linux users. I want to add that code to my app, because the customers don't have any understanding about linux. I found that QSettings can do that, is it true? What about QService ? Can we use a simple code like this? QSettings

QSettings IniFormat File gets empty after restart

99封情书 提交于 2019-12-24 03:28:05
问题 I use QSettings to save and load parameters to/from an ini file using Linux: write: QSettings settings("setup.ini", QSettings::IniFormat); settings.beginGroup("Setup_Parameter"); settings.setValue("Parameter1",parameter1_value); settings.sync(); settings.endGroup(); read: QSettings settings("setup.ini", QSettings::IniFormat); settings.beginGroup("Setup_Parameter"); parameter1_value = settings.value("Parameter1","0").toInt(); settings.endGroup(); The setup.ini works fine, while the system is

Can i read from .ini file which located in resources files?

独自空忆成欢 提交于 2019-12-22 08:52:58
问题 #include "mainwindow.h" #include "ui_mainwindow.h" #include <QSettings> #include <QDebug> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QSettings * qsettings = new QSettings(":/config.ini",QSettings::IniFormat); bool status = qsettings->value("preview","").toBool(); qDebug() << status; } MainWindow::~MainWindow() { delete ui; } Once i could do it but now i don't know whats wrong. When i googled this problem i just saw that this

QSettings does not differentiate between string and int values

有些话、适合烂在心里 提交于 2019-12-12 20:26:07
问题 I am writing and reading string and int values using a file-backed QSettings object. When I later try to read the values from a different process, the values are read as strings instead of int. This is the code I am using to write values: QSettings settings("TestQSettings.ini", QSettings::IniFormat); settings.setValue("AAA",QString("111")); settings.setValue("BBB",222); This is the file created: [General] AAA=111 BBB=222 This is the code I am using to read values: QVariant qvar = settings

Where does Qt/C++ Store System Scope QSettings on Mac OSX 10?

女生的网名这么多〃 提交于 2019-12-08 07:10:39
问题 According to Qt's docs for the latest Qt version, looking at QSettings, they say that system scope of settings on a Mac are stored in a directory /etc/xdg. Unfortunately, I'm not finding this to be the case on Mac OSX 10.10 Yosemite. Where do they store these settings? I mean, I've gotten QSettings to work in this example, but no /etc/xdg folder is to be found even when I do sudo su and assume root on my Mac in order to access that folder. 回答1: On a MacOS, $HOME/Library/Preferences/ should be