diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-21 15:37:11 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-21 15:37:11 (GMT) |
commit | e6af7e74a901bc4971a70750a81558ea474d55d7 (patch) | |
tree | 1394b61866ad31f67d6a7165b1a2a9eaae497326 /tools | |
parent | 9dbba618af3b505c0aac590d0b0ec32eabb76d76 (diff) | |
parent | 05500482c4b7f810bd4c073739bdedf0b8783738 (diff) | |
download | Qt-e6af7e74a901bc4971a70750a81558ea474d55d7.zip Qt-e6af7e74a901bc4971a70750a81558ea474d55d7.tar.gz Qt-e6af7e74a901bc4971a70750a81558ea474d55d7.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (75 commits)
Autotests: if you use X11 libs, you must link to X11 libs explicitly.
Disable C++0x mode for QtWebKit and QtScript since WebKit will not compile any time soon with C++0x
Compile Phonon in C++0x mode.
Compile Qt in C++0x mode.
Avoid a data relocation by not trying to store a pointer in the .data section of plugins.
Fix cast-from-ascii warning
Fix compilation on Linux
Fix compilation with WINSCW: #include doesn't find files in the same dir
Rename m_volume to m_vol
Add 2 signals, introduce side widget, make it possible to reset startId
Do not create native window handle just because a parent has one.
Tab color fix for document mode on Snow Leopard.
Revert "Don't emit open signal on session close/error."
Rename networkAccess property to networkAccessible.
Don't emit open signal on session close/error.
Rename private signal.
Autotest: fix instability by accepting rounding errors
Dont force height for filter widget
- Fix importdir option on unix/linux configure
Remove incorrect semi-colons after Q_PROPERTY
...
Diffstat (limited to 'tools')
-rw-r--r-- | tools/designer/src/components/formeditor/formeditor.qrc | 1 | ||||
-rw-r--r-- | tools/designer/src/components/formeditor/images/cleartext.png | bin | 0 -> 760 bytes | |||
-rw-r--r-- | tools/designer/src/components/widgetbox/widgetbox.cpp | 5 | ||||
-rw-r--r-- | tools/designer/src/lib/shared/filterwidget.cpp | 160 | ||||
-rw-r--r-- | tools/designer/src/lib/shared/filterwidget_p.h | 52 | ||||
-rw-r--r-- | tools/qdoc3/generator.cpp | 8 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 12 |
7 files changed, 125 insertions, 113 deletions
diff --git a/tools/designer/src/components/formeditor/formeditor.qrc b/tools/designer/src/components/formeditor/formeditor.qrc index 83cc9c7..6510814 100644 --- a/tools/designer/src/components/formeditor/formeditor.qrc +++ b/tools/designer/src/components/formeditor/formeditor.qrc @@ -63,6 +63,7 @@ <file>images/qtlogo.png</file> <file>images/qt3logo.png</file> <file>images/resetproperty.png</file> + <file>images/cleartext.png</file> <file>images/sort.png</file> <file>images/edit.png</file> <file>images/reload.png</file> diff --git a/tools/designer/src/components/formeditor/images/cleartext.png b/tools/designer/src/components/formeditor/images/cleartext.png Binary files differnew file mode 100644 index 0000000..74133ba --- /dev/null +++ b/tools/designer/src/components/formeditor/images/cleartext.png diff --git a/tools/designer/src/components/widgetbox/widgetbox.cpp b/tools/designer/src/components/widgetbox/widgetbox.cpp index 512d6ba..091135a 100644 --- a/tools/designer/src/components/widgetbox/widgetbox.cpp +++ b/tools/designer/src/components/widgetbox/widgetbox.cpp @@ -74,7 +74,10 @@ WidgetBox::WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent, Qt::Wi FilterWidget *filterWidget = new FilterWidget(0, FilterWidget::LayoutAlignNone); filterWidget->setRefuseFocus(true); connect(filterWidget, SIGNAL(filterChanged(QString)), m_view, SLOT(filter(QString))); - l->addWidget(filterWidget); + + QToolBar *toolBar = new QToolBar(this); + toolBar->addWidget(filterWidget); + l->addWidget(toolBar); // View connect(m_view, SIGNAL(pressed(QString,QString,QPoint)), diff --git a/tools/designer/src/lib/shared/filterwidget.cpp b/tools/designer/src/lib/shared/filterwidget.cpp index 6c73a08..f485346 100644 --- a/tools/designer/src/lib/shared/filterwidget.cpp +++ b/tools/designer/src/lib/shared/filterwidget.cpp @@ -44,13 +44,17 @@ #include <QtGui/QVBoxLayout> #include <QtGui/QHBoxLayout> -#include <QtGui/QPushButton> #include <QtGui/QLineEdit> #include <QtGui/QFocusEvent> #include <QtGui/QPalette> #include <QtGui/QCursor> +#include <QtGui/QToolButton> +#include <QtGui/QPainter> +#include <QtGui/QStyle> +#include <QtGui/QStyleOption> #include <QtCore/QDebug> +#include <QtCore/QPropertyAnimation> enum { debugFilter = 0 }; @@ -61,12 +65,44 @@ namespace qdesigner_internal { HintLineEdit::HintLineEdit(QWidget *parent) : QLineEdit(parent), m_defaultFocusPolicy(focusPolicy()), - m_hintColor(QColor(0xbbbbbb)), - m_refuseFocus(false), - m_showingHintText(false) + m_refuseFocus(false) { } +IconButton::IconButton(QWidget *parent) + : QToolButton(parent) +{ + setCursor(Qt::ArrowCursor); +} + +void IconButton::paintEvent(QPaintEvent *) +{ + QPainter painter(this); + // Note isDown should really use the active state but in most styles + // this has no proper feedback + QPixmap iconpixmap = icon().pixmap(ICONBUTTON_SIZE, ICONBUTTON_SIZE, isDown() ? + QIcon::Selected : QIcon::Normal); + QRect pixmapRect = QRect(0, 0, iconpixmap.width(), iconpixmap.height()); + pixmapRect.moveCenter(rect().center()); + painter.setOpacity(m_fader); + painter.drawPixmap(pixmapRect, iconpixmap); +} + +void IconButton::animateShow(bool visible) +{ + if (visible) { + QPropertyAnimation *animation = new QPropertyAnimation(this, "fader"); + animation->setDuration(160); + animation->setEndValue(1.0); + animation->start(QAbstractAnimation::DeleteWhenStopped); + } else { + QPropertyAnimation *animation = new QPropertyAnimation(this, "fader"); + animation->setDuration(160); + animation->setEndValue(0.0); + animation->start(QAbstractAnimation::DeleteWhenStopped); + } +} + bool HintLineEdit::refuseFocus() const { return m_refuseFocus; @@ -111,92 +147,53 @@ void HintLineEdit::focusInEvent(QFocusEvent *e) } } - hideHintText(); QLineEdit::focusInEvent(e); } -void HintLineEdit::focusOutEvent(QFocusEvent *e) -{ - if (debugFilter) - qDebug() << Q_FUNC_INFO; - // Focus out: Switch to displaying the hint text unless there is user input - showHintText(); - QLineEdit::focusOutEvent(e); -} - -QString HintLineEdit::hintText() const +// ------------------- FilterWidget +FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm) : + QWidget(parent), + m_editor(new HintLineEdit(this)), + m_button(new IconButton(m_editor)), + m_buttonwidth(0) { - return m_hintText; -} + m_editor->setPlaceholderText(tr("Filter")); -void HintLineEdit::setHintText(const QString &ht) -{ - if (ht == m_hintText) - return; - hideHintText(); - m_hintText = ht; - if (!hasFocus() && !ht.isEmpty()) - showHintText(); -} + // Let the style determine minimum height for our widget + QSize size(ICONBUTTON_SIZE + 2, ICONBUTTON_SIZE + 2); -void HintLineEdit::showHintText(bool force) -{ - if (m_showingHintText || m_hintText.isEmpty()) - return; - if (force || text().isEmpty()) { - m_showingHintText = true; - setText(m_hintText); - setTextColor(m_hintColor, &m_textColor); - } -} -void HintLineEdit::hideHintText() -{ - if (m_showingHintText && !m_hintText.isEmpty()) { - m_showingHintText = false; - setText(QString()); - setTextColor(m_textColor); + // Note KDE does not reserve space for the highlight color + if (style()->inherits("OxygenStyle")) { + size = size.expandedTo(QSize(24, 0)); } -} -bool HintLineEdit::isShowingHintText() const -{ - return m_showingHintText; -} - -QString HintLineEdit::typedText() const -{ - return m_showingHintText ? QString() : text(); -} + // Make room for clear icon + QMargins margins = m_editor->textMargins(); + if (layoutDirection() == Qt::LeftToRight) + margins.setRight(size.width()); + else + margins.setLeft(size.width()); -void HintLineEdit::setTextColor(const QColor &newColor, QColor *oldColor) -{ - QPalette pal = palette(); - if (oldColor) - *oldColor = pal.color(QPalette::Text); - pal.setColor(QPalette::Text, newColor); - setPalette(pal);} + m_editor->setTextMargins(margins); -// ------------------- FilterWidget -FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm) : - QWidget(parent), - m_button(new QPushButton), - m_editor(new HintLineEdit) -{ - m_editor->setHintText(tr("<Filter>")); QHBoxLayout *l = new QHBoxLayout(this); l->setMargin(0); l->setSpacing(0); - if (lm == LayoutAlignRight) l->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); l->addWidget(m_editor); - m_button->setIcon(createIconSet(QLatin1String("resetproperty.png"))); - m_button->setIconSize(QSize(8, 8)); - m_button->setFlat(true); - l->addWidget(m_button); + // KDE has custom icons for this. Notice that icon namings are counter intuitive + // If these icons are not avaiable we use the freedesktop standard name before + // falling back to a bundled resource + QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ? + QLatin1String("edit-clear-locationbar-rtl") : + QLatin1String("edit-clear-locationbar-ltr"), + QIcon::fromTheme("edit-clear", createIconSet(QLatin1String("cleartext.png")))); + m_button->setIcon(icon); + m_button->setToolTip(tr("Clear text")); connect(m_button, SIGNAL(clicked()), this, SLOT(reset())); connect(m_editor, SIGNAL(textChanged(QString)), this, SLOT(checkButton(QString))); connect(m_editor, SIGNAL(textEdited(QString)), this, SIGNAL(filterChanged(QString))); @@ -204,25 +201,38 @@ FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm) : QString FilterWidget::text() const { - return m_editor->typedText(); + return m_editor->text(); } void FilterWidget::checkButton(const QString &) { - m_button->setEnabled(!text().isEmpty()); + m_button->animateShow(!m_editor->text().isEmpty()); } void FilterWidget::reset() { if (debugFilter) qDebug() << Q_FUNC_INFO; - if (!text().isEmpty()) { + + if (!m_editor->text().isEmpty()) { // Editor has lost focus once this is pressed - m_editor->showHintText(true); + m_editor->clear(); emit filterChanged(QString()); } } +void FilterWidget::resizeEvent(QResizeEvent *) +{ + QRect contentRect = m_editor->rect(); + if (layoutDirection() == Qt::LeftToRight) { + const int iconoffset = m_editor->textMargins().right() + 4; + m_button->setGeometry(contentRect.adjusted(m_editor->width() - iconoffset, 0, 0, 0)); + } else { + const int iconoffset = m_editor->textMargins().left() + 4; + m_button->setGeometry(contentRect.adjusted(0, 0, -m_editor->width() + iconoffset, 0)); + } +} + bool FilterWidget::refuseFocus() const { return m_editor->refuseFocus(); diff --git a/tools/designer/src/lib/shared/filterwidget_p.h b/tools/designer/src/lib/shared/filterwidget_p.h index 025d708..423b30e 100644 --- a/tools/designer/src/lib/shared/filterwidget_p.h +++ b/tools/designer/src/lib/shared/filterwidget_p.h @@ -58,58 +58,55 @@ #include <QtGui/QWidget> #include <QtGui/QLineEdit> #include <QtGui/QColor> +#include <QtGui/QToolButton> QT_BEGIN_NAMESPACE -class QPushButton; +class QToolButton; namespace qdesigner_internal { -/* A line edit that displays a grayed hintText (like "Type Here to Filter") - * when not focused and empty. When connecting to the changed signals and - * querying text, one has to be aware that the text is set to that hint - * text if isShowingHintText() returns true (that is, does not contain - * valid user input). This widget should never have initial focus +/* This widget should never have initial focus * (ie, be the first widget of a dialog, else, the hint cannot be displayed. * For situations, where it is the only focusable control (widget box), * there is a special "refuseFocus()" mode, in which it clears the focus * policy and focusses explicitly on click (note that setting Qt::ClickFocus * is not sufficient for that as an ActivationFocus will occur). */ +#define ICONBUTTON_SIZE 16 + class QDESIGNER_SHARED_EXPORT HintLineEdit : public QLineEdit { Q_OBJECT public: explicit HintLineEdit(QWidget *parent = 0); - QString hintText() const; - - bool isShowingHintText() const; - - // Convenience for accessing the text that returns "" in case of isShowingHintText(). - QString typedText() const; - bool refuseFocus() const; void setRefuseFocus(bool v); -public slots: - void setHintText(const QString &ht); - void showHintText(bool force = false); - void hideHintText(); - protected: virtual void mousePressEvent(QMouseEvent *event); virtual void focusInEvent(QFocusEvent *e); - virtual void focusOutEvent(QFocusEvent *e); private: - void setTextColor(const QColor &newColor, QColor *oldColor = 0); - const Qt::FocusPolicy m_defaultFocusPolicy; - const QColor m_hintColor; - QColor m_textColor; bool m_refuseFocus; - QString m_hintText; - bool m_showingHintText; +}; + +// IconButton: This is a simple helper class that represents clickable icons + +class IconButton: public QToolButton +{ + Q_OBJECT + Q_PROPERTY(float fader READ fader WRITE setFader) +public: + IconButton(QWidget *parent); + void paintEvent(QPaintEvent *event); + float fader() { return m_fader; } + void setFader(float value) { m_fader = value; update(); } + void animateShow(bool visible); + +private: + float m_fader; }; // FilterWidget: For filtering item views, with reset button Uses HintLineEdit. @@ -128,7 +125,7 @@ public: explicit FilterWidget(QWidget *parent = 0, LayoutMode lm = LayoutAlignRight); QString text() const; - + void resizeEvent(QResizeEvent *); bool refuseFocus() const; // see HintLineEdit void setRefuseFocus(bool v); @@ -142,8 +139,9 @@ private slots: void checkButton(const QString &text); private: - QPushButton *m_button; HintLineEdit *m_editor; + IconButton *m_button; + int m_buttonwidth; }; } // namespace qdesigner_internal diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 0c6497b..62f191b 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -1194,14 +1194,14 @@ void Generator::appendSortedQmlNames(Text& text, QMap<QString,Text> classMap; int index = 0; -#ifdef DEBUG_MULTIPLE QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES qDebug() << "Generator::appendSortedQmlNames():" << base->name() << "is inherited by..."; -#endif +#endif for (int i = 0; i < subs.size(); ++i) { Text t; -#ifdef DEBUG_MULTIPLE QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES qDebug() << " " << subs[i]->name(); -#endif +#endif appendFullName(t, subs[i], base, marker); classMap[t.toString().toLower()] = t; } diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index d60ff73..bd37443 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1297,9 +1297,9 @@ QmlClassNode::QmlClassNode(InnerNode *parent, */ QmlClassNode::~QmlClassNode() { -#ifdef DEBUG_MULTIPLE QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES qDebug() << "Deleting QmlClassNode:" << name(); -#endif +#endif } /*! @@ -1334,9 +1334,9 @@ QString QmlClassNode::fileBase() const void QmlClassNode::addInheritedBy(const QString& base, Node* sub) { inheritedBy.insert(base,sub); -#ifdef DEBUG_MULTIPLE QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE-QDOCCONF_FILES qDebug() << "QmlClassNode::addInheritedBy(): insert" << base << sub->name() << inheritedBy.size(); -#endif +#endif } /*! @@ -1347,10 +1347,10 @@ void QmlClassNode::subclasses(const QString& base, NodeList& subs) subs.clear(); if (inheritedBy.count(base) > 0) { subs = inheritedBy.values(base); -#ifdef DEBUG_MULTIPLE QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES qDebug() << "QmlClassNode::subclasses():" << inheritedBy.count(base) << base << "subs:" << subs.size() << "total size:" << inheritedBy.size(); -#endif +#endif } } |