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 @@
4
-
-
+
+
+
+ 0
+ 0
+
+
+
-
@@ -123,7 +130,7 @@
16777215
- 100
+ 16777215