Salome HOME
Copyright update 2022
[modules/gui.git] / src / Qtx / QtxColorButton.cxx
index f6cfda61669d188a15b319052b46e1e50ebdcc44..6743ca3ccf755c59a1355eb5283ed3d074702724 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -54,7 +54,7 @@ QtxColorButton::QtxColorButton( QWidget* parent )
 : QToolButton( parent )
 {
   setCheckable( false );
-  setPopupMode( MenuButtonPopup ); // VSR 11/10/2010 temporarily roolback from InstantPopup (regressions)
+  setPopupMode( InstantPopup );
 
   QMenu* pm = new QMenu( this );
   QGridLayout* grid = new QGridLayout( pm );
@@ -325,7 +325,7 @@ void QtxColorButton::paintEvent( QPaintEvent* e )
 */
 void QtxColorButton::updateState()
 {
-  QList<QToolButton*> bList = qFindChildren<QToolButton*>( menu() );
+  QList<QToolButton*> bList = menu()->findChildren<QToolButton*>();
   for ( QList<QToolButton*>::iterator cit = bList.begin(); cit != bList.end(); ++cit )
     updateButton( *cit );
 }
@@ -413,6 +413,17 @@ QList<QColor> QtxColorButton::colorsList() const
   return lst;
 }
 
+/*!
+  \brief Get size hint for this widget.
+*/
+QSize QtxColorButton::sizeHint() const
+{
+  QSize sz = QToolButton::sizeHint();
+  sz.setWidth( sz.width() + 18 );
+  return sz;
+}
+
+
 /*!
   \fn void QtxColorButton::clicked( QColor color );
   \brief This signal is emitted when the widget button is clicked by