mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Use QPushButton on the preview modal
This commit is contained in:
parent
773575ce52
commit
adf2019c56
3 changed files with 9 additions and 16 deletions
|
@ -46,9 +46,8 @@ constexpr int TEXT_SPACING = 4;
|
|||
constexpr int BUTTON_SIZE = 36;
|
||||
constexpr int BUTTON_RADIUS = BUTTON_SIZE / 2;
|
||||
|
||||
constexpr float BUTTON_TEXT_SIZE_RATIO = 1.3;
|
||||
constexpr float LABEL_MEDIUM_SIZE_RATIO = 1.3;
|
||||
constexpr float LABEL_BIG_SIZE_RATIO = 2;
|
||||
constexpr auto LABEL_MEDIUM_SIZE_RATIO = 1.3;
|
||||
constexpr auto LABEL_BIG_SIZE_RATIO = 2;
|
||||
}
|
||||
|
||||
namespace strings {
|
||||
|
|
|
@ -39,14 +39,13 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
|
|||
: QWidget{parent}
|
||||
, titleLabel_{this}
|
||||
, fileName_{this}
|
||||
, upload_{tr("Upload").toUpper(), this}
|
||||
, cancel_{tr("Cancel").toUpper(), this}
|
||||
, upload_{tr("Upload"), this}
|
||||
, cancel_{tr("Cancel"), this}
|
||||
{
|
||||
auto hlayout = new QHBoxLayout;
|
||||
hlayout->addStretch(1);
|
||||
hlayout->addWidget(&upload_);
|
||||
hlayout->addWidget(&cancel_);
|
||||
hlayout->setSpacing(0);
|
||||
hlayout->addWidget(&upload_);
|
||||
hlayout->setMargin(0);
|
||||
|
||||
auto vlayout = new QVBoxLayout{this};
|
||||
|
@ -57,6 +56,7 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
|
|||
vlayout->setSpacing(conf::modals::WIDGET_SPACING);
|
||||
vlayout->setMargin(conf::modals::WIDGET_MARGIN);
|
||||
|
||||
upload_.setDefault(true);
|
||||
connect(&upload_, &QPushButton::clicked, [this]() {
|
||||
emit confirmUpload(data_, mediaType_, fileName_.text());
|
||||
close();
|
||||
|
@ -96,11 +96,6 @@ PreviewUploadOverlay::init()
|
|||
upload_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
cancel_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
QFont buttonFont;
|
||||
buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
|
||||
upload_.setFont(buttonFont);
|
||||
cancel_.setFont(buttonFont);
|
||||
|
||||
if (isImage_) {
|
||||
infoLabel_.setAlignment(Qt::AlignCenter);
|
||||
|
||||
|
|
|
@ -20,10 +20,9 @@
|
|||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPixmap>
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ui/FlatButton.h"
|
||||
|
||||
class QMimeData;
|
||||
|
||||
namespace dialogs {
|
||||
|
@ -55,7 +54,7 @@ private:
|
|||
QLabel infoLabel_;
|
||||
QLineEdit fileName_;
|
||||
|
||||
FlatButton upload_;
|
||||
FlatButton cancel_;
|
||||
QPushButton upload_;
|
||||
QPushButton cancel_;
|
||||
};
|
||||
} // dialogs
|
||||
|
|
Loading…
Reference in a new issue