/usr/include/libkdcraw/squeezedcombobox.h is in libkdcraw-dev 4:4.14.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | /** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2008-08-21
* @brief a combo box with a width not depending of text
* content size
*
* @author Copyright (C) 2006-2013 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2008 by Andi Clemens
* <a href="mailto:andi dot clemens at googlemail dot com">andi dot clemens at googlemail dot com</a>
* @author Copyright (C) 2005 by Tom Albers
* <a href="mailto:tomalbers at kde dot nl">tomalbers at kde dot nl</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef SQUEEZEDCOMBOBOX_H
#define SQUEEZEDCOMBOBOX_H
// Qt includes
#include <QtGui/QComboBox>
// Local includes
#include "libkdcraw_export.h"
namespace KDcrawIface
{
/** @class SqueezedComboBox
*
* This widget is a QComboBox, but then a little bit
* different. It only shows the right part of the items
* depending on de size of the widget. When it is not
* possible to show the complete item, it will be shortened
* and "..." will be prepended.
*/
class LIBKDCRAW_EXPORT SqueezedComboBox : public QComboBox
{
Q_OBJECT
public:
/**
* Constructor
* @param parent parent widget
* @param name name to give to the widget
*/
explicit SqueezedComboBox(QWidget* const parent = 0, const char* name = 0 );
/**
* destructor
*/
virtual ~SqueezedComboBox();
/**
*
* Returns true if the combobox contains the original (not-squeezed)
* version of text.
* @param text the original (not-squeezed) text to check for
*/
bool contains(const QString& text) const;
/**
* This inserts a item to the list. See QComboBox::insertItem()
* for details. Please do not use QComboBox::insertItem() to this
* widget, as that will fail.
* @param newItem the original (long version) of the item which needs
* to be added to the combobox
* @param index the position in the widget.
* @param userData custom meta-data assigned to new item.
*/
void insertSqueezedItem(const QString& newItem, int index,
const QVariant& userData=QVariant());
/**
* This inserts items to the list. See QComboBox::insertItems()
* for details. Please do not use QComboBox:: insertItems() to this
* widget, as that will fail.
* @param newItems the originals (long version) of the items which needs
* to be added to the combobox
* @param index the position in the widget.
*/
void insertSqueezedList(const QStringList& newItems, int index);
/**
* Append an item.
* @param newItem the original (long version) of the item which needs
* to be added to the combobox
* @param userData custom meta-data assigned to new item.
*/
void addSqueezedItem(const QString& newItem,
const QVariant& userData=QVariant());
/**
* Set the current item to the one matching the given text.
*
* @param itemText the original (long version) of the item text
*/
void setCurrent(const QString& itemText);
/**
* This method returns the full text (not squeezed) of the currently
* highlighted item.
* @return full text of the highlighted item
*/
QString itemHighlighted() const;
/**
* This method returns the full text (not squeezed) for the index.
* @param index the position in the widget.
* @return full text of the item
*/
QString item(int index) const;
/**
* Sets the sizeHint() of this widget.
*/
virtual QSize sizeHint() const;
private Q_SLOTS:
void slotTimeOut();
void slotUpdateToolTip(int index);
private:
void resizeEvent(QResizeEvent*);
QString squeezeText(const QString& original) const;
// Prevent these from being used.
QString currentText() const;
void setCurrentText(const QString& itemText);
void insertItem(const QString& text);
void insertItem(qint32 index, const QString& text);
void insertItem(int index, const QIcon& icon, const QString& text, const QVariant& userData=QVariant());
void insertItems(int index, const QStringList& list);
void addItem(const QString& text);
void addItem(const QIcon& icon, const QString& text, const QVariant& userData=QVariant());
void addItems(const QStringList& texts);
QString itemText(int index) const;
private:
class Private;
Private* const d;
};
} // namespace KDcrawIface
#endif // SQUEEZEDCOMBOBOX_H
|