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. Changing cursor type when focus shifts from QTableView cell
Qt 6.11 is out! See what's new in the release blog

Changing cursor type when focus shifts from QTableView cell

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 2 Posters 2.1k Views 2 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.
  • G Offline
    G Offline
    gabor53
    wrote on last edited by
    #1

    Hi,
    In my delegate's setModelData I would like to change the cursor to hourglass and at the end of setModelData back to arrow.
    This is what I have now:

    
    void WhatFixViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* fixModel, const QModelIndex& index) const {
    
    
      QCursor* hold = new QCursor();
      hold->setShape (Qt::WaitCursor);
    
    
      QComboBox* whatComboEditor = editor->findChild<QComboBox*>();
      Q_ASSERT(whatComboEditor);
      if (whatComboEditor) {
        QString newWhatText;
    
        newWhatText = whatComboEditor->currentText ();
    
        fixModel->setData (index, newWhatText, Qt::EditRole);
    
        fixModel->submit ();
    
        FixDb* mFixDb = new FixDb;
        mFixDb->exec ();
      }
    }
    

    How can I set the cursor in this case, when the user clicks outside the box?
    Thank you.

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

      Hi,

      From your description you should rather emit signals at the start and end of your setModelData call and in the slot you connect to it use setCursor.

      Note that currently it looks like you have two memory leaks.

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

      G 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        From your description you should rather emit signals at the start and end of your setModelData call and in the slot you connect to it use setCursor.

        Note that currently it looks like you have two memory leaks.

        G Offline
        G Offline
        gabor53
        wrote on last edited by
        #3

        @SGaist
        Where do I have the leeks?

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

          You never delete hold nor mFixDb.

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

          G 1 Reply Last reply
          0
          • SGaistS SGaist

            You never delete hold nor mFixDb.

            G Offline
            G Offline
            gabor53
            wrote on last edited by
            #5

            @SGaist
            Would it be possible to integrate QtQuick's BusyIndicator for this?

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

              Do you mean replace the cursor with a BusyIndicator or just show a widget with that indicator ?

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

              G 1 Reply Last reply
              0
              • SGaistS SGaist

                Do you mean replace the cursor with a BusyIndicator or just show a widget with that indicator ?

                G Offline
                G Offline
                gabor53
                wrote on last edited by
                #7

                @SGaist
                Show a widget with that indicator.

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

                  Then yes.

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

                  G 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Then yes.

                    G Offline
                    G Offline
                    gabor53
                    wrote on last edited by
                    #9

                    @SGaist
                    Can you please recommend a tutorial about using QtKwick within a Qt app?

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

                      The Qt documentation.

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

                      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