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. ModelView programing with Delegate in qt

ModelView programing with Delegate in qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 612 Views
  • 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.
  • H Offline
    H Offline
    hjohn
    wrote on 23 Jun 2018, 10:14 last edited by
    #1

    When I create QSpinBox in createEditor() of QStyleItemDelegate class,It displays in side the cell of the QTableview.
    But when I create QDialog in that function,It gets display out side(seperatly).What could be the reason?

    M 1 Reply Last reply 23 Jun 2018, 10:50
    0
    • H hjohn
      23 Jun 2018, 10:14

      When I create QSpinBox in createEditor() of QStyleItemDelegate class,It displays in side the cell of the QTableview.
      But when I create QDialog in that function,It gets display out side(seperatly).What could be the reason?

      M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 23 Jun 2018, 10:50 last edited by
      #2

      @hjohn
      Hi
      A dialog is a windows type and not embeddable as a widget.
      You can just use QWidget as base class and it will work.
      Since you want to put it inside the cell, QDialog is not the right base class.

      H 1 Reply Last reply 23 Jun 2018, 11:12
      0
      • M mrjj
        23 Jun 2018, 10:50

        @hjohn
        Hi
        A dialog is a windows type and not embeddable as a widget.
        You can just use QWidget as base class and it will work.
        Since you want to put it inside the cell, QDialog is not the right base class.

        H Offline
        H Offline
        hjohn
        wrote on 23 Jun 2018, 11:12 last edited by
        #3

        @mrjj yeah thanks..I will try it using QWidgets.

        M 1 Reply Last reply 23 Jun 2018, 11:14
        0
        • H hjohn
          23 Jun 2018, 11:12

          @mrjj yeah thanks..I will try it using QWidgets.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 23 Jun 2018, 11:14 last edited by mrjj
          #4

          @hjohn
          Hi
          Its just 2 place to change in code then its Qwidget.
          No reason to recreate it all again. very easy to switch.

          In .h
          class mine : public QDialog <<< the actual base

          and in .cpp
          mine::mine(QWidget *parent) : QDialog(parent), << change the call to base for constructor

          maybe #include <QWidgets> instead of QDialog

          Note:
          there is also
          myDialog->setWindowFlags(Qt::Widget)
          after you construct the dialog.
          It might do the same. not tested. though.

          1 Reply Last reply
          0

          1/4

          23 Jun 2018, 10:14

          • Login

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