Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I tried to reproduce your problem, but everything is working fine for me. Here is what I did :</p> <p>With Qt-Designer, I put a <code>QTableView</code> (named <code>tbvTest</code>) on my form.</p> <p>In the constructor of my form, here is what I've written :</p> <pre><code>Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui-&gt;setupUi(this); ui-&gt;tbvTest-&gt;setModel(new TableModel); QSettings MySetting(QSettings::IniFormat, QSettings::UserScope, "Test"); QByteArray MyArray = MySetting.value("column_width", "").toByteArray(); ui-&gt;tbvTest-&gt;horizontalHeader()-&gt;restoreState(MyArray); } </code></pre> <p>(note that in my <code>main.cpp</code>, I set the <a href="http://doc.trolltech.com/4.6/qcoreapplication.html#applicationName-prop" rel="noreferrer">ApplicationName</a>, <a href="http://doc.trolltech.com/4.6/qcoreapplication.html#organizationName-prop" rel="noreferrer">OrganizationName</a> and <a href="http://doc.trolltech.com/4.6/qcoreapplication.html#organizationDomain-prop" rel="noreferrer">OrganizationDomain</a>)</p> <p>In the destructor of my form, here is what I've written :</p> <pre><code>Widget::~Widget() { QByteArray MyArray = ui-&gt;tbvTest-&gt;horizontalHeader()-&gt;saveState(); QSettings MySetting(QSettings::IniFormat, QSettings::UserScope, "Test"); MySetting.setValue("column_width", MyArray); delete ui; } </code></pre> <p>If I run the application and change the column width, quit the app and run it again, the column widths are correctly restored.</p> <p>Is there something I'm doing different from you ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload