Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Creator QTableView horizontalHeader()



  • Can't set a minimum width (or vertical height) for the Table headers.
    Use this before (Qt Creator 4 .. I think) ..
    view->horizontalHeader()->setMinimumSectionsSize(1);
    view->verticalHeader()->setMinimumSectionsSize(1);
    but get error now with Qt Creator 6.0 "member access into incomplete type 'QHeaderView'

    I want to set the Row and Col to 1 (very small) but can't seem to get there.
    Help greatly appreciated
    OtG.



  • @OscarTheGrouch
    This does not look like "Qt Creator", assuming by that you meant the Designer component. This looks like code you write in your .cpp file. You may happen to use Qt Creator's IDE to edit your files, but this is no Creator issue.

    You will get the incomplete type 'QHeaderView' error if you have failed to precede your lines by #include <QHeaderView>, which you should do.

    I do not know why you are using Qt 6, if that's what you are saying. It has only just been released, and may have issues. I would be using Qt 5.



  • @JonB said in Qt Creator QTableView horizontalHeader():

    @OscarTheGrouch
    This does not look like "Qt Creator", assuming by that you meant the Designer component. This looks like code you write in your .cpp file. You may happen to use Qt Creator's IDE to edit your files, but this is no Creator issue.

    You will get the incomplete type 'QHeaderView' error if you have failed to precede your lines by #include <QHeaderView>, which you should do.

    I do not know why you are using Qt 6, if that's what you are saying. It has only just been released, and may have issues. I would be using Qt 5.

    It is Qt Creator Code. It was written in 2018. I was using Linux Mint 18 MATE at the time. After installing LM 20 MATE all that was installed was Qt Designer. I hadn't work on this code in quite some time, I'm pretty sure it was done with Netbeans as a Qt Project. It complied and ran without that header included at that point. ALMOST ALL the code connected with the Data Modeling and Table View worked with the includes I had in the original project. It was based on Example code from the Help files.

    Qt 6 is what the web site offers for download. They don't make it easy to figure out what version it is either. Because I'm only interested as a hobbyist, I used the Open Source version. It is even confusing when you check the version from "About" it says

    Qt Creator 4.13.3
    Based on Qt 5.15.2 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)

    Built on Nov 13 2020 12:29:31

    Tools->Options->Kits show 'Desktop Qt 6.0.0 GCC 64bit'

    So they are pretty confusing in a number of ways IMO, but Netbeans can't do C++ right now and I find no other platform for doing Desktop code for Linux.

    I will add the Header file and see if that solves the issue. Thanks for the reply.
    OtG



  • @JonB That worked, my TableView header size is correct. Still have other issues yet to figure out, like the Table View doesn't close when I close the App and the goes behind the Main Window when I Select something from the MenuBar.
    Thanks again,
    OtG


Log in to reply