mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-03 23:29:06 +00:00
Improve size adjustment of itemlist editor
Currently multi-line file names in dolphin only display a single line when renaming. This commit ensures multi-line filenames have all lines displayed by calling `document()->adjustSize` in `KItemListRoleEditor::autoAdjustSize`, and by calling the latter function after setting up the editor. BUG: 452587
This commit is contained in:
parent
91a4d5da94
commit
8297e0a8c9
|
@ -821,6 +821,7 @@ void KStandardItemListWidget::editedRoleChanged(const QByteArray ¤t, const
|
|||
rect.setWidth(parent->width() - rect.left());
|
||||
}
|
||||
m_roleEditor->setGeometry(rect.toRect());
|
||||
m_roleEditor->autoAdjustSize();
|
||||
m_roleEditor->show();
|
||||
m_roleEditor->setFocus();
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ void KItemListRoleEditor::autoAdjustSize()
|
|||
{
|
||||
const qreal frameBorder = 2 * frameWidth();
|
||||
|
||||
document()->adjustSize();
|
||||
const qreal requiredWidth = document()->size().width();
|
||||
const qreal availableWidth = size().width() - frameBorder;
|
||||
if (requiredWidth > availableWidth) {
|
||||
|
|
|
@ -51,17 +51,17 @@ Q_SIGNALS:
|
|||
void roleEditingFinished(const QByteArray &role, const QVariant &value);
|
||||
void roleEditingCanceled(const QByteArray &role, const QVariant &value);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Increases the size of the editor in case if there is not
|
||||
* enough room for the text.
|
||||
*/
|
||||
void autoAdjustSize();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Emits the signal roleEditingFinished if m_blockFinishedSignal
|
||||
|
|
Loading…
Reference in a new issue