mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(status): enable text selection in about friend dialog
Enables text selection in the about friend dialog, allowing selection and copying of status and username.
This commit is contained in:
parent
1935d0c6ec
commit
ae24311237
|
@ -4,8 +4,6 @@
|
|||
#include "src/persistence/profile.h"
|
||||
#include "src/nexus.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
@ -18,21 +16,10 @@ AboutUser::AboutUser(ToxId &toxId, QWidget *parent) :
|
|||
ui->label_4->hide();
|
||||
ui->aliases->hide();
|
||||
|
||||
statusMessageMenu.addAction(tr("Copy"), this, SLOT(onCopyStatusMessage()));
|
||||
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AboutUser::onAcceptedClicked);
|
||||
connect(ui->autoaccept, &QCheckBox::clicked, this, &AboutUser::onAutoAcceptClicked);
|
||||
connect(ui->selectSaveDir, &QPushButton::clicked, this, &AboutUser::onSelectDirClicked);
|
||||
connect(ui->removeHistory, &QPushButton::clicked, this, &AboutUser::onRemoveHistoryClicked);
|
||||
connect(ui->statusMessage, &QLabel::customContextMenuRequested, this, [&](const QPoint& pos)
|
||||
{
|
||||
if(!ui->statusMessage->text().isEmpty())
|
||||
{
|
||||
QWidget* sender = static_cast<QWidget*>(QObject::sender());
|
||||
|
||||
statusMessageMenu.exec(sender->mapToGlobal(pos));
|
||||
}
|
||||
} );
|
||||
|
||||
this->toxId = toxId;
|
||||
QString dir = Settings::getInstance().getAutoAcceptDir(this->toxId);
|
||||
|
@ -118,17 +105,6 @@ void AboutUser::onRemoveHistoryClicked()
|
|||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
void AboutUser::onCopyStatusMessage()
|
||||
{
|
||||
QString text = ui->statusMessage->text();
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
|
||||
if (clipboard)
|
||||
{
|
||||
clipboard->setText(text, QClipboard::Clipboard);
|
||||
}
|
||||
}
|
||||
|
||||
AboutUser::~AboutUser()
|
||||
{
|
||||
delete ui;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define ABOUTUSER_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMenu>
|
||||
#include "src/friend.h"
|
||||
|
||||
|
||||
|
@ -21,7 +20,6 @@ public:
|
|||
|
||||
private:
|
||||
Ui::AboutUser *ui;
|
||||
QMenu statusMessageMenu;
|
||||
ToxId toxId;
|
||||
|
||||
private slots:
|
||||
|
@ -29,7 +27,6 @@ private slots:
|
|||
void onAutoAcceptClicked();
|
||||
void onSelectDirClicked();
|
||||
void onRemoveHistoryClicked();
|
||||
void onCopyStatusMessage();
|
||||
};
|
||||
|
||||
#endif // ABOUTUSER_H
|
||||
|
|
|
@ -31,19 +31,19 @@
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignBottom">
|
||||
<widget class="QLabel" name="statusMessage">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -56,6 +56,12 @@
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in New Issue
Block a user