How to change Qcombobox popup width
-
this->view() returns an QAbstractItemView which is derived from QWidget. QWidget has a method named setMinimumWidth() ....
what Qt version do you use?! -
wrote on 7 Aug 2013, 19:53 last edited by
[quote author="raven-worx" date="1375899990"]this->view() returns an QAbstractItemView which is derived from QWidget. QWidget has a method named setMinimumWidth() ....
what Qt version do you use?![/quote]Sure, QWidget has a member function setMinimumWidth(),
my problem is inside setMinimumWidth(),
this->view()->sizeHintForColumn(0) ( QWidget hasn't a methode sizeHintForColumn(0)
-
no...but QAbstractItemView does!
Since you implicitly cast the view instance to a QWidget it's clear that the compiler complains about it! -
wrote on 7 Aug 2013, 23:04 last edited by
[quote author="raven-worx" date="1375905485"]no...but QAbstractItemView does!
Since you implicitly cast the view instance to a QWidget it's clear that the compiler complains about it![/quote]I have no idea how i can do this
-
change the line
@
QWidget *view = this->view() ;
@
to
@
QAbstractItemView *view = this->view() ;
@or just use the code i've posted in first place!
-
wrote on 9 Aug 2013, 19:09 last edited by
[quote author="raven-worx" date="1375946208"]change the line
@
QWidget *view = this->view() ;
@
to
@
QAbstractItemView *view = this->view() ;
@or just use the code i've posted in first place![/quote]
also not working for me , always the width of Qtableview don't increased
-
wrote on 10 Aug 2013, 07:34 last edited by
how i can increase only the width of popup (Qtableview) ???
-
wrote on 10 Aug 2013, 11:50 last edited by
like so,
////////////////////////////////
// combobox //
//////////////////////////////////////////////////////////////////////////////////
// Qtableview her with all cells inside it ** Horizontal Header //
/////////////////////////////////////////////////////////////////////////////////
/// row 0 //
/////////////////////////////////////////////////////////////////////////////////
/// row 1 //
/////////////////////////////////////////////////////////////////////////////////
/// row 2 //
///////////////////////////////////////////////////////////////////////////////// -
wrote on 11 Aug 2013, 06:57 last edited by
no body know about this ?
-
wrote on 12 Aug 2013, 17:36 last edited by
plz inform me if my question is clear or no ?
-
wrote on 13 Aug 2013, 16:38 last edited by
i have used this but not working
-
wrote on 7 Oct 2013, 09:33 last edited by
This works perfect, Thank you very much.
[quote author="raven-worx" date="1375879559"]you can subclass QComboBox and reimplement showPopup() method if you need the size content dependent. Something like this:
@
void MyComboBox::showPopup()
{
this->view()->setMinimumWidth(this->view()->sizeHintForColumn(0));
QComboBox::showPopup();
}
@[/quote]