[Digikam-devel] [Bug 138747] Crash on Add Camera
Gilles Caulier
caulier.gilles at kdemail.net
Thu Dec 14 06:47:08 GMT 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=138747
------- Additional Comments From caulier.gilles kdemail net 2006-12-14 07:47 -------
SVN commit 613590 by cgilles:
digikam from trunk : Force QComboBox to use internaly a QListBox independantly of current widget style used by QT.
CCBUGS: 138747
M +20 -14 squeezedcombobox.cpp
M +6 -6 squeezedcombobox.h
--- trunk/extragear/graphics/digikam/libs/widgets/common/squeezedcombobox.cpp #613589:613590
@ -38,9 +38,11 @
// Local includes.
#include "squeezedcombobox.h"
+#include "squeezedcombobox.moc"
namespace Digikam
{
+
class SqueezedComboBoxPriv
{
public:
@ -58,12 +60,17 @
SqueezedComboBoxTip *tooltip;
};
-SqueezedComboBox::SqueezedComboBox( QWidget *parent, const char *name )
- : QComboBox( parent, name )
+SqueezedComboBox::SqueezedComboBox(QWidget *parent, const char *name)
+ : QComboBox(parent, name)
{
d = new SqueezedComboBoxPriv;
- d->timer = new QTimer(this);
- d->tooltip = new SqueezedComboBoxTip( listBox()->viewport(), this );
+ d->timer = new QTimer(this);
+
+ // See B.K.O #138747 : always for QComboBox instance to use a QListbox to
+ // render content independently of Widget style used.
+ setListBox(new QListBox(this));
+
+ d->tooltip = new SqueezedComboBoxTip(listBox()->viewport(), this);
setMinimumWidth(100);
connect(d->timer, SIGNAL(timeout()),
@ -102,7 +109,7 @
slotUpdateToolTip(0);
}
-void SqueezedComboBox::resizeEvent( QResizeEvent * )
+void SqueezedComboBox::resizeEvent(QResizeEvent *)
{
d->timer->start(200, true);
}
@ -113,15 +120,15 @
for (it = d->originalItems.begin() ; it != d->originalItems.end();
++it)
{
- changeItem( squeezeText( it.data() ), it.key() );
+ changeItem(squeezeText(it.data()), it.key());
}
}
-QString SqueezedComboBox::squeezeText( const QString& original)
+QString SqueezedComboBox::squeezeText(const QString& original)
{
// not the complete widgetSize is usable. Need to compensate for that.
int widgetSize = width()-30;
- QFontMetrics fm( fontMetrics() );
+ QFontMetrics fm(fontMetrics());
// If we can fit the full text, return that.
if (fm.width(original) < widgetSize)
@ -132,7 +139,7 @
widgetSize = widgetSize-fm.width("...");
for (uint i = 0 ; i != original.length(); ++i)
{
- if ( (int)fm.width(original.right(i)) > widgetSize)
+ if ((int)fm.width(original.right(i)) > widgetSize)
{
sqItem = QString("..." + original.right(--i));
break;
@ -141,7 +148,7 @
return sqItem;
}
-void SqueezedComboBox::slotUpdateToolTip( int index )
+void SqueezedComboBox::slotUpdateToolTip(int index)
{
QToolTip::remove(this);
QToolTip::add(this, d->originalItems[index]);
@ -155,13 +162,13 @
// ------------------------------------------------------------------------
-SqueezedComboBoxTip::SqueezedComboBoxTip( QWidget * parent, SqueezedComboBox* name )
+SqueezedComboBoxTip::SqueezedComboBoxTip(QWidget *parent, SqueezedComboBox *name)
: QToolTip( parent )
{
m_originalWidget = name;
}
-void SqueezedComboBoxTip::maybeTip( const QPoint &pos )
+void SqueezedComboBoxTip::maybeTip(const QPoint &pos)
{
QListBox* listBox = m_originalWidget->listBox();
if (!listBox)
@ -170,7 +177,7 @
QListBoxItem* selectedItem = listBox->itemAt( pos );
if (selectedItem)
{
- QRect positionToolTip = listBox->itemRect( selectedItem );
+ QRect positionToolTip = listBox->itemRect(selectedItem);
QString toolTipText = m_originalWidget->itemHighlighted();
if (!toolTipText.isNull())
tip(positionToolTip, toolTipText);
@ -179,4 +186,3 @
} // namespace Digikam
-#include "squeezedcombobox.moc"
--- trunk/extragear/graphics/digikam/libs/widgets/common/squeezedcombobox.h #613589:613590
@ -80,7 +80,7 @
* highlighted item.
* return full text of the highlighted item
*/
- QString itemHighlighted( );
+ QString itemHighlighted();
/**
* Sets the sizeHint() of this widget.
@ -90,12 +90,12 @
private slots:
void slotTimeOut();
- void slotUpdateToolTip( int index );
+ void slotUpdateToolTip(int index);
private:
- void resizeEvent( QResizeEvent * );
- QString squeezeText( const QString& original);
+ void resizeEvent(QResizeEvent *);
+ QString squeezeText(const QString& original);
private:
@ -127,7 +127,7 @
* param parent parent widget (viewport)
* param name parent widget
*/
- SqueezedComboBoxTip( QWidget *parent, SqueezedComboBox *name );
+ SqueezedComboBoxTip(QWidget *parent, SqueezedComboBox *name);
protected:
/**
@ -135,7 +135,7 @
* tooltip when needed.
* param pos the point where the mouse currently is
*/
- void maybeTip( const QPoint& pos );
+ void maybeTip(const QPoint& pos);
private:
More information about the Digikam-devel
mailing list