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
Forum Updated to NodeBB v4.3 + New Features

ModelView programing with Delegate in qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 661 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.
  • H Offline
    H Offline
    hjohn
    wrote on 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?

    mrjjM 1 Reply Last reply
    0
    • H hjohn

      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?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on 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
      0
      • mrjjM mrjj

        @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 last edited by
        #3

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

        mrjjM 1 Reply Last reply
        0
        • H hjohn

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

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on 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

          • Login

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