mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 13:08:50 +02:00
UI: Add text autoselect on scene rename
This commit is contained in:
parent
a0ead6f974
commit
bd71839259
@ -258,6 +258,8 @@ OBSBasic::OBSBasic(QWidget *parent)
|
||||
ui->scenes->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
ui->sources->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
|
||||
ui->scenes->setItemDelegate(new SceneRenameDelegate(ui->scenes));
|
||||
|
||||
auto displayResize = [this]() {
|
||||
struct obs_video_info ovi;
|
||||
|
||||
@ -7178,3 +7180,17 @@ bool OBSBasic::ReplayBufferActive()
|
||||
return false;
|
||||
return outputHandler->ReplayBufferActive();
|
||||
}
|
||||
|
||||
SceneRenameDelegate::SceneRenameDelegate(QObject *parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneRenameDelegate::setEditorData(QWidget *editor,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QStyledItemDelegate::setEditorData(editor, index);
|
||||
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
|
||||
if (lineEdit)
|
||||
lineEdit->selectAll();
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QAction>
|
||||
#include <QWidgetAction>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <obs.hpp>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@ -816,3 +817,12 @@ public:
|
||||
private:
|
||||
std::unique_ptr<Ui::OBSBasic> ui;
|
||||
};
|
||||
|
||||
class SceneRenameDelegate : public QStyledItemDelegate {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SceneRenameDelegate(QObject *parent);
|
||||
virtual void setEditorData(QWidget *editor, const QModelIndex &index)
|
||||
const override;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user