Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Save sort and col on tableWigets event
Forum Updated to NodeBB v4.3 + New Features

Save sort and col on tableWigets event

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • cfdevC Offline
    cfdevC Offline
    cfdev
    wrote on last edited by
    #1

    Hi all,

    I have an problem when I try to save the states od tableWidgets with SIGNAL.
    this is my code (Qt 4.8.7) :

    connect(ui->tableWidget->horizontalHeader(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder )), this, SLOT(on_tableWidgetCust_sort(int, Qt::SortOrder)) );
    
    connect(ui->tableWidget->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_tableWidgetCust_geo()) );
    

    when I run I have this message:

    QMetaObject::connectSlotsByName: No matching signal for on_tableWidgetCust_sort(int,Qt::SortOrder)
    QMetaObject::connectSlotsByName: No matching signal for on_tableWidgetCust_geo()
    
    

    Also, I have 4 tableWidgets to save in my widgets and some save and restore correctly but other not, order sort only and not width of colonne...s strange comportement.

    How do you do to save and restore states of tableWidgets correctly with events ?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Maybe a silly question but do you have a on_tableWidgetCust_sort slot in your widget ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      cfdevC 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Maybe a silly question but do you have a on_tableWidgetCust_sort slot in your widget ?

        cfdevC Offline
        cfdevC Offline
        cfdev
        wrote on last edited by
        #3

        @SGaist Unfortunately no... but I found the strange comportement :
        Before restore the state, I used setColumnWidth function.

        // Code forget to delete
        	ui->tableWidget->setColumnWidth(2,300); // <- causes strange behavior with restoreState function
        // Restore state
        	ui->tableWidget->horizontalHeader()->restoreState(m_settings->getTableCustomers());
        

        After have deleted this line, It works well... but there is always warning message on slot...(in release version)

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then you have have to implement a slot named on_tableWidgetCust_sort if you need it or delete the connection from designer.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          cfdevC 1 Reply Last reply
          0
          • SGaistS SGaist

            Then you have have to implement a slot named on_tableWidgetCust_sort if you need it or delete the connection from designer.

            cfdevC Offline
            cfdevC Offline
            cfdev
            wrote on last edited by cfdev
            #5

            @SGaist yes I need both slots, one on geometric change and an other on sort change! I use savestate on this slots.

            I dont use the designer tool to create this slots (not presents) and it's possible that the raison of this warning message.... Because I connect the signal to slot in construct widget.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Ok, then change the name of these slots by e.g. removing underscores use camel case onTableWidgetCustSort. Currently the name of your slots uses the same format as Designer to auto-connect signals from the widgets in your ui files to custom slots in your code.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              cfdevC 1 Reply Last reply
              1
              • SGaistS SGaist

                Ok, then change the name of these slots by e.g. removing underscores use camel case onTableWidgetCustSort. Currently the name of your slots uses the same format as Designer to auto-connect signals from the widgets in your ui files to custom slots in your code.

                cfdevC Offline
                cfdevC Offline
                cfdev
                wrote on last edited by
                #7

                @SGaist Ok!! it's just that thanks SGaist ;)

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved