[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Btelepathy-chat-handler=5D_lib=3A_Resize_textbox_to_?=
From: David Edmundson <kde () davidedmundson ! co ! uk>
Date: 2011-02-28 23:41:27
Message-ID: 20110228234127.A9AA5A60D1 () git ! kde ! org
[Download RAW message or body]
Git commit ffbd8a42c515fdfe8f3df6acc86f1485d16700ba by David Edmundson.
Committed on 12/02/2011 at 00:07.
Pushed by davidedmundson into branch 'master'.
Resize textbox to be at most 1/3 of the total chat window size.
M +13 -0 lib/chatwidget.cpp
M +1 -0 lib/chatwidget.h
M +9 -2 lib/chatwidget.ui
http://commits.kde.org/telepathy-chat-handler/ffbd8a42c515fdfe8f3df6acc86f1485d16700ba
diff --git a/lib/chatwidget.cpp b/lib/chatwidget.cpp
index 2d57f49..137aa60 100644
--- a/lib/chatwidget.cpp
+++ b/lib/chatwidget.cpp
@@ -210,6 +210,17 @@ void ChatWidget::changeEvent(QEvent *e)
}
}
+void ChatWidget::resizeEvent(QResizeEvent *e)
+{
+ //set the maximum height of a text box to a third of the total window height \
(but no smaller than the minimum size) + int textBoxHeight = e->size().height() / \
3; + if (textBoxHeight < d->ui.sendMessageBox->minimumSizeHint().height()) {
+ textBoxHeight = d->ui.sendMessageBox->minimumSizeHint().height();
+ }
+ d->ui.sendMessageBox->setMaximumHeight(textBoxHeight);
+ QWidget::resizeEvent(e);
+}
+
QString ChatWidget::title() const
{
@@ -534,5 +545,7 @@ KIcon ChatWidget::iconForPresence(Tp::ConnectionPresenceType \
presence) return KIcon(iconName);
}
+
+
#include "chatwidget.moc" //for MessageBoxEventFilter
#include "moc_chatwidget.cpp" //for ChatWidget
diff --git a/lib/chatwidget.h b/lib/chatwidget.h
index dff8a1e..95d4eb6 100644
--- a/lib/chatwidget.h
+++ b/lib/chatwidget.h
@@ -46,6 +46,7 @@ public:
protected:
void changeEvent(QEvent *e);
+ void resizeEvent(QResizeEvent *);
protected slots:
/** Show the received message in the chat window*/
diff --git a/lib/chatwidget.ui b/lib/chatwidget.ui
index 8c74787..338729d 100644
--- a/lib/chatwidget.ui
+++ b/lib/chatwidget.ui
@@ -21,7 +21,14 @@
<number>4</number>
</property>
<item>
- <widget class="AdiumThemeView" name="chatArea" native="true"/>
+ <widget class="AdiumThemeView" name="chatArea" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
</item>
<item>
<widget class="QWidget" name="formatToolbar" native="true">
@@ -123,7 +130,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
- <height>100</height>
+ <height>16777215</height>
</size>
</property>
<property name="frameShape">
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic