mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 09:50:12 +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());
|
rect.setWidth(parent->width() - rect.left());
|
||||||
}
|
}
|
||||||
m_roleEditor->setGeometry(rect.toRect());
|
m_roleEditor->setGeometry(rect.toRect());
|
||||||
|
m_roleEditor->autoAdjustSize();
|
||||||
m_roleEditor->show();
|
m_roleEditor->show();
|
||||||
m_roleEditor->setFocus();
|
m_roleEditor->setFocus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,7 @@ void KItemListRoleEditor::autoAdjustSize()
|
||||||
{
|
{
|
||||||
const qreal frameBorder = 2 * frameWidth();
|
const qreal frameBorder = 2 * frameWidth();
|
||||||
|
|
||||||
|
document()->adjustSize();
|
||||||
const qreal requiredWidth = document()->size().width();
|
const qreal requiredWidth = document()->size().width();
|
||||||
const qreal availableWidth = size().width() - frameBorder;
|
const qreal availableWidth = size().width() - frameBorder;
|
||||||
if (requiredWidth > availableWidth) {
|
if (requiredWidth > availableWidth) {
|
||||||
|
|
|
@ -51,17 +51,17 @@ Q_SIGNALS:
|
||||||
void roleEditingFinished(const QByteArray &role, const QVariant &value);
|
void roleEditingFinished(const QByteArray &role, const QVariant &value);
|
||||||
void roleEditingCanceled(const QByteArray &role, const QVariant &value);
|
void roleEditingCanceled(const QByteArray &role, const QVariant &value);
|
||||||
|
|
||||||
protected:
|
public Q_SLOTS:
|
||||||
bool event(QEvent *event) override;
|
|
||||||
void keyPressEvent(QKeyEvent *event) override;
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
/**
|
/**
|
||||||
* Increases the size 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.
|
* enough room for the text.
|
||||||
*/
|
*/
|
||||||
void autoAdjustSize();
|
void autoAdjustSize();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool event(QEvent *event) override;
|
||||||
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Emits the signal roleEditingFinished if m_blockFinishedSignal
|
* Emits the signal roleEditingFinished if m_blockFinishedSignal
|
||||||
|
|
Loading…
Reference in a new issue