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. Custom editor for a delegate
Forum Updated to NodeBB v4.3 + New Features

Custom editor for a delegate

Scheduled Pinned Locked Moved Unsolved General and Desktop
29 Posts 3 Posters 9.0k 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.
  • M Offline
    M Offline
    Maser
    wrote on last edited by Maser
    #20

    No, i can. I told you. if i aim right in the black marked cell, i can click and unclick the three left items, i can also click the three right items. Just when i click anywhere in the tablecells, the editor is gone.

    PS: Maybe i have to somehow resize the "working area" of the cell to to fit my editor. I mean the clickable area associated with the cell. Idea on that?

    mrjjM 1 Reply Last reply
    0
    • M Maser

      No, i can. I told you. if i aim right in the black marked cell, i can click and unclick the three left items, i can also click the three right items. Just when i click anywhere in the tablecells, the editor is gone.

      PS: Maybe i have to somehow resize the "working area" of the cell to to fit my editor. I mean the clickable area associated with the cell. Idea on that?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #21

      @Maser
      Hi
      The cell has the size it has.

      The Editor can be anything so it should be possible
      to float a transparent widget where u paint the pics
      and get the selection.

      Can u show code for editor creation ?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Maser
        wrote on last edited by Maser
        #22
        class ClickableIconHolder : public QWidget
        {
            Q_OBJECT
        public:
            ClickableIconHolder(uint Mark, QWidget *parent = 0);
            QSize sizeHint() const Q_DECL_OVERRIDE;
        signals:
            void editingFinished();
        protected:
            void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
        private:
            QHBoxLayout *hbLayout;
            ClickableIcon *ci1 = 0;
            ClickableIcon *ci2 = 0;
            ClickableIcon *ci3 = 0;
            ClickableIcon *ci4 = 0;
            ClickableIcon *ci5 = 0;
            ClickableIcon *ci6 = 0;
            ClickableIcon *ci7 = 0;
        };
        

        Here is the header of the editor-widget. I create some clickable QLabel and add them to a HBoxLayout, thats all in general. I dont do nothing in the paintevent yet.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Maser
          wrote on last edited by Maser
          #23

          I tried to go cardcore and draw the widget myself, with no parent pased to it, but the problem is, the delegate doesnt wait for my editor to pass the data, whem im not making the editor delegates child. Im afraid for that id have to dig deep in the delegates sourcecode...

          mrjjM 1 Reply Last reply
          0
          • M Maser

            I tried to go cardcore and draw the widget myself, with no parent pased to it, but the problem is, the delegate doesnt wait for my editor to pass the data, whem im not making the editor delegates child. Im afraid for that id have to dig deep in the delegates sourcecode...

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #24

            @Maser
            well unless u want to use the normals means (combo / popup dialog)
            then yes i think
            you should look around in delegate code to get good idea.

            1 Reply Last reply
            2
            • M Offline
              M Offline
              Maser
              wrote on last edited by Maser
              #25

              Nah, that would be a waste of time at this point. I just took QDialog as a parentclass to my editor, now i can click everything and after i positioned it, it stays where it should be. Im not done yet completly implementing it, but the appearance(apart of some big margins for the boundaries) is quite what i wanted.
              Thanks so far))

              mrjjM 1 Reply Last reply
              1
              • M Maser

                Nah, that would be a waste of time at this point. I just took QDialog as a parentclass to my editor, now i can click everything and after i positioned it, it stays where it should be. Im not done yet completly implementing it, but the appearance(apart of some big margins for the boundaries) is quite what i wanted.
                Thanks so far))

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #26

                @Maser
                please post final look :)

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Maser
                  wrote on last edited by
                  #27

                  http://www.picfront.org/d/9q8q
                  That is the look now. I added a Qt::FramelessWindowHint flag and this seems to be the minimal size. I have not figured out yet how to reduze the margins.

                  mrjjM 1 Reply Last reply
                  1
                  • M Maser

                    http://www.picfront.org/d/9q8q
                    That is the look now. I added a Qt::FramelessWindowHint flag and this seems to be the minimal size. I have not figured out yet how to reduze the margins.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by mrjj
                    #28

                    @Maser
                    Ok . looks nice.
                    Did you use a layout ?
                    It has margins.
                    http://doc.qt.io/qt-5/qlayout.html#setContentsMargins

                    "On most platforms, the margin is 11 pixels in all directions."

                    1 Reply Last reply
                    1
                    • M Offline
                      M Offline
                      Maser
                      wrote on last edited by Maser
                      #29

                      yes, the hboxlayout. Ok, i set the margins now. Looks better. Thanks again))

                      1 Reply Last reply
                      1

                      • Login

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