[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kexi
From: Jarosław Staniek <staniek () kde ! org>
Date: 2009-11-08 21:06:34
Message-ID: 1257714394.793889.18567.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1046488 by staniek:
Forms
*only create data source overlay label for text edit when really needed
M +0 -2 formeditor/form.cpp
M +0 -2 plugins/forms/widgets/kexidbcombobox.cpp
M +31 -13 plugins/forms/widgets/kexidbtextedit.cpp
M +2 -0 plugins/forms/widgets/kexidbtextedit.h
--- trunk/koffice/kexi/formeditor/form.cpp #1046487:1046488
@@ -3356,8 +3356,6 @@
connect(editor, SIGNAL(textChanged(const QString&)), this, \
SLOT(changeInlineTextInternal(const QString&)));
connect(args.widget, SIGNAL(destroyed()), this, SLOT(widgetDestroyed()));
connect(editor, SIGNAL(destroyed()), this, SLOT(editorDeleted()));
-
- d->inlineEditor = editor;
}
d->inlineEditor->installEventFilter(this);
d->inlineEditor->setFont(args.widget->font());
--- trunk/koffice/kexi/plugins/forms/widgets/kexidbcombobox.cpp #1046487:1046488
@@ -408,8 +408,6 @@
KexiDBAutoField::setPaletteBackgroundColor(color);
QPalette pal(palette());
QColorGroup cg(pal.active());
- pal.setColor(QColorGroup::Base, Qt::red);
- pal.setColor(QColorGroup::Background, Qt::red);
pal.setActive(cg);
QWidget::setPalette(pal);
update();
--- trunk/koffice/kexi/plugins/forms/widgets/kexidbtextedit.cpp #1046487:1046488
@@ -74,18 +74,13 @@
, KexiFormDataItemInterface()
, m_menuExtender(this, this)
, m_slotTextChanged_enabled(true)
+ , m_dataSourceLabel(0)
{
QFont tmpFont;
tmpFont.setPointSize(KGlobalSettings::smallestReadableFont().pointSize());
setMinimumHeight(QFontMetrics(tmpFont).height() + 6);
connect(this, SIGNAL(textChanged()), this, SLOT(slotTextChanged()));
setAutoFillBackground(true); // otherwise we get transparent background...
- m_dataSourceLabel = new DataSourceLabel(viewport());
- m_dataSourceLabel->hide();
- m_dataSourceLabel->move(0, 0);
- int leftMargin, topMargin, rightMargin, bottomMargin;
- getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin);
- m_dataSourceLabel->setContentsMargins(leftMargin, topMargin, rightMargin, \
bottomMargin); // installEventFilter(this);
}
@@ -269,11 +264,15 @@
bool res = KTextEdit::event(e);
if (e->type() == QEvent::LayoutDirectionChange) {
- m_dataSourceLabel->setLayoutDirection( layoutDirection() );
+ if (m_dataSourceLabel) {
+ m_dataSourceLabel->setLayoutDirection( layoutDirection() );
+ }
updateTextForDataSource();
}
else if (e->type() == QEvent::Resize) {
- m_dataSourceLabel->setFixedWidth(width());
+ if (m_dataSourceLabel) {
+ m_dataSourceLabel->setFixedWidth(width());
+ }
}
return res;
}
@@ -281,14 +280,21 @@
void KexiDBTextEdit::updateTextForDataSource()
{
if (!designMode()) {
- m_dataSourceLabel->hide();
+ if (m_dataSourceLabel) {
+ m_dataSourceLabel->hide();
+ }
return;
}
setPlainText(QString());
- m_dataSourceLabel->setText(dataSource());
- m_dataSourceLabel->setIndent( KexiFormUtils::dataSourceTagIcon().width()
- + (layoutDirection() == Qt::LeftToRight ? 0 : 7) );
- m_dataSourceLabel->show();
+ if (!m_dataSourceLabel && !dataSource().isEmpty()) {
+ createDataSourceLabel();
+ }
+ if (m_dataSourceLabel) {
+ m_dataSourceLabel->setText(dataSource());
+ m_dataSourceLabel->setIndent( KexiFormUtils::dataSourceTagIcon().width()
+ + (layoutDirection() == Qt::LeftToRight ? 0 : 7) );
+ m_dataSourceLabel->setVisible(!dataSource().isEmpty());
+ }
}
void KexiDBTextEdit::setDataSource(const QString &ds)
@@ -303,4 +309,16 @@
updateTextForDataSource();
}
+void KexiDBTextEdit::createDataSourceLabel()
+{
+ if (m_dataSourceLabel)
+ return;
+ m_dataSourceLabel = new DataSourceLabel(viewport());
+ m_dataSourceLabel->hide();
+ m_dataSourceLabel->move(0, 0);
+ int leftMargin, topMargin, rightMargin, bottomMargin;
+ getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin);
+ m_dataSourceLabel->setContentsMargins(leftMargin, topMargin, rightMargin, \
bottomMargin); +}
+
#include "kexidbtextedit.moc"
--- trunk/koffice/kexi/plugins/forms/widgets/kexidbtextedit.h #1046487:1046488
@@ -115,7 +115,9 @@
virtual void setValueInternal(const QVariant& add, bool removeOld);
QMenu * createPopupMenu(const QPoint & pos);
void updateTextForDataSource();
+ void createDataSourceLabel();
+private:
//! Used for extending context menu
KexiDBWidgetContextMenuExtender m_menuExtender;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic