Results 1 to 14 of 14

Thread: Column/Row no of ComboBox Widget in Table

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    Vadodara, Gujarat, India
    Posts
    65
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    16
    Thanked 2 Times in 2 Posts

    Default Re: Column/Row no of ComboBox Widget in Table

    jpn:

    thanx buddy.... i worked the 3rd solution.

    thanx to munna, zlatko and all others who read the post and replied ....

    this forum is really helpful to me ....
    Do what u r afraid to do, and the death of fear is sure.

  2. #2
    Join Date
    Jan 2006
    Location
    India
    Posts
    54
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 7 Times in 6 Posts

    Default Re: Column/Row no of ComboBox Widget in Table

    I also want to do the same thing and I have approached to implement this thing is, I subclass the QComboBox and add some my custom slot and signal.
    header file
    Qt Code:
    1. #ifndef _MY_COMBO_BOX_H
    2. #define _MY_COMBO_BOX_H
    3.  
    4. #include <qobject.h>
    5. #include <qcombobox.h>
    6.  
    7. //***********Defination of OdyComboBox****************
    8.  
    9. class CMyComboBox : public QComboBox
    10. {
    11. Q_OBJECT
    12.  
    13. public:
    14. CMyComboBox ( int row, int column, QWidget * parent, const char * name = 0 ) ;
    15.  
    16. signals:
    17. void activated (int row, int column, const QString & string);
    18.  
    19. public slots:
    20. void reEmitActivated(const QString &);
    21.  
    22. private:
    23. int row;
    24. int column;
    25. };
    26.  
    27. #endif
    To copy to clipboard, switch view to plain text mode 

    and source File

    Qt Code:
    1. //***********Implementation of OdyComboBox****************
    2.  
    3. CMyComboBox::CMyComboBox (int row, int column, QWidget * parent, const char * name )
    4. : QComboBox( parent, name ), row(row), column(column) {
    5.  
    6. setPaletteBackgroundColor( Qt::white );
    7. connect( this, SIGNAL(activated (const QString &)), this, SLOT(reEmitActivated(const QString &) ));
    8. }
    9.  
    10. void CMyComboBox::reEmitActivated(const QString & string) {
    11. emit activated( row, column, string );
    12. }
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to sumsin for this useful post:

    ankurjain (23rd May 2006)

  4. #3
    Join Date
    Mar 2006
    Location
    Vadodara, Gujarat, India
    Posts
    65
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    16
    Thanked 2 Times in 2 Posts

    Default Re: Column/Row no of ComboBox Widget in Table

    hi sumsin,
    ur implementation was nice .... i got a bit confused in the code :

    Qt Code:
    1. CMyComboBox::CMyComboBox (int row, int column, QWidget * parent, const char * name )
    2. : QComboBox( parent, name ), row(row), column(column)
    To copy to clipboard, switch view to plain text mode 

    u inherited QComboBox, now in the constructor, what the lines row(row),column(column) mean?

    Qt Code:
    1. void CMyComboBox::reEmitActivated(const QString & string) {
    2. emit activated( row, column, string );
    3. }
    To copy to clipboard, switch view to plain text mode 

    here how u got the row and column ?

    i am a new user to this ..... so if its too easy, then also pls reply ....
    Do what u r afraid to do, and the death of fear is sure.

  5. #4
    Join Date
    Jan 2006
    Posts
    667
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    10
    Thanked 80 Times in 74 Posts

    Default Re: Column/Row no of ComboBox Widget in Table

    u inherited QComboBox, now in the constructor, what the lines row(row),column(column) mean?
    This is NOT inside QComboBox's constructor. Row and Column are getting initialized.

    here how u got the row and column ?
    row and column are member variables of CMyComboBox.

  6. The following user says thank you to munna for this useful post:

    ankurjain (23rd May 2006)

  7. #5
    Join Date
    Jan 2006
    Location
    India
    Posts
    54
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 7 Times in 6 Posts

    Default Re: Column/Row no of ComboBox Widget in Table

    Exactly. What munna says.
    Thanks munna.

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. Table Widget Vs. Table View
    By winston2020 in forum Qt Programming
    Replies: 2
    Last Post: 19th October 2008, 09:56
  3. Replies: 4
    Last Post: 4th February 2008, 06:16
  4. customizing table widget
    By krishna.bv in forum Qt Programming
    Replies: 1
    Last Post: 25th January 2007, 13:43
  5. Dynamic updates to a table widget
    By guiGuy in forum Qt Programming
    Replies: 6
    Last Post: 1st June 2006, 20:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.