- Increase the editor-height in the icons-view if required
- Don't try to react on resizings of the parent, just finish
the renaming
if (rect.right() > parent->width()) {
rect.setWidth(parent->width() - rect.left());
}
if (rect.right() > parent->width()) {
rect.setWidth(parent->width() - rect.left());
}
+ if (rect.bottom() > parent->height()) {
+ rect.setHeight(parent->height() - rect.top());
+ }
m_roleEditor->setGeometry(rect.toRect());
m_roleEditor->show();
m_roleEditor->setFocus();
m_roleEditor->setGeometry(rect.toRect());
m_roleEditor->show();
m_roleEditor->setFocus();
bool KItemListRoleEditor::eventFilter(QObject* watched, QEvent* event)
{
if (watched == parentWidget() && event->type() == QEvent::Resize) {
bool KItemListRoleEditor::eventFilter(QObject* watched, QEvent* event)
{
if (watched == parentWidget() && event->type() == QEvent::Resize) {
+ emit roleEditingFinished(m_index, m_role, toPlainText());
}
return KTextEdit::eventFilter(watched, event);
}
return KTextEdit::eventFilter(watched, event);
void KItemListRoleEditor::autoAdjustSize()
{
void KItemListRoleEditor::autoAdjustSize()
{
+ const qreal frameBorder = 2 * frameWidth();
+
const qreal requiredWidth = document()->size().width();
const qreal requiredWidth = document()->size().width();
- const qreal availableWidth = size().width() - 2 * frameWidth();
+ const qreal availableWidth = size().width() - frameBorder;
if (requiredWidth > availableWidth) {
if (requiredWidth > availableWidth) {
- qreal newWidth = requiredWidth + 2 * frameWidth();
+ qreal newWidth = requiredWidth + frameBorder;
if (parentWidget() && pos().x() + newWidth > parentWidget()->width()) {
newWidth = parentWidget()->width() - pos().x();
}
resize(newWidth, size().height());
}
if (parentWidget() && pos().x() + newWidth > parentWidget()->width()) {
newWidth = parentWidget()->width() - pos().x();
}
resize(newWidth, size().height());
}
+
+ const qreal requiredHeight = document()->size().height();
+ const qreal availableHeight = size().height() - frameBorder;
+ if (requiredHeight > availableHeight) {
+ qreal newHeight = requiredHeight + frameBorder;
+ if (parentWidget() && pos().y() + newHeight > parentWidget()->height()) {
+ newHeight = parentWidget()->height() - pos().y();
+ }
+ resize(size().width(), newHeight);
+ }
}
#include "kitemlistroleeditor.moc"
}
#include "kitemlistroleeditor.moc"
* pressing Escape or when losing the focus) or when the editing
* got finished (e.g. by pressing Enter or Return).
*
* pressing Escape or when losing the focus) or when the editing
* got finished (e.g. by pressing Enter or Return).
*
- * The width automatically gets increased if the text does not
- * fit into the available width.
+ * The size automatically gets increased if the text does not fit.
*/
class LIBDOLPHINPRIVATE_EXPORT KItemListRoleEditor : public KTextEdit
{
*/
class LIBDOLPHINPRIVATE_EXPORT KItemListRoleEditor : public KTextEdit
{
- * Increases the width of the editor in case if there is not
+ * Increases the size of the editor in case if there is not
* enough room for the text.
*/
void autoAdjustSize();
* enough room for the text.
*/
void autoAdjustSize();