mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-03 18:57:37 +01:00
Added responsize resizer.
This commit is contained in:
parent
fd2ec44fa2
commit
f792b7d197
@ -24,13 +24,19 @@
|
|||||||
#include "miscellaneous/iconfactory.h"
|
#include "miscellaneous/iconfactory.h"
|
||||||
#include "services/standard/standardserviceentrypoint.h"
|
#include "services/standard/standardserviceentrypoint.h"
|
||||||
|
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
#include <QSize>
|
||||||
|
|
||||||
FormAddAccount::FormAddAccount(const QList<ServiceEntryPoint*>& entry_points, FeedsModel* model, QWidget* parent)
|
FormAddAccount::FormAddAccount(const QList<ServiceEntryPoint*>& entry_points, FeedsModel* model, QWidget* parent)
|
||||||
: QDialog(parent), m_ui(new Ui::FormAddAccount), m_model(model), m_entryPoints(entry_points) {
|
: QDialog(parent), m_ui(new Ui::FormAddAccount), m_model(model), m_entryPoints(entry_points) {
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
|
#if defined (Q_OS_ANDROID)
|
||||||
|
GuiUtilities::applyResponsiveDialogResize(*this);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
GuiUtilities::applyDialogProperties(*this, qApp->icons()->fromTheme(QSL("document-new")));
|
GuiUtilities::applyDialogProperties(*this, qApp->icons()->fromTheme(QSL("document-new")));
|
||||||
|
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
|
|
||||||
#include "definitions/definitions.h"
|
#include "definitions/definitions.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
#include <QSize>
|
||||||
|
|
||||||
void GuiUtilities::setLabelAsNotice(QLabel& label, bool is_warning) {
|
void GuiUtilities::setLabelAsNotice(QLabel& label, bool is_warning) {
|
||||||
label.setMargin(6);
|
label.setMargin(6);
|
||||||
|
|
||||||
@ -39,3 +43,12 @@ void GuiUtilities::applyDialogProperties(QWidget& widget, const QIcon& icon, con
|
|||||||
widget.setWindowTitle(title);
|
widget.setWindowTitle(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuiUtilities::applyResponsiveDialogResize(QWidget& widget, double factor) {
|
||||||
|
auto desktop_geom = QApplication::desktop()->screenGeometry();
|
||||||
|
auto ratio = double(size().height()) / size().width();
|
||||||
|
int widt = desktop_geom.width() * factor;
|
||||||
|
int heig = widt * ratio;
|
||||||
|
|
||||||
|
widget.resize(widt, heig);
|
||||||
|
}
|
||||||
|
@ -26,6 +26,7 @@ class GuiUtilities {
|
|||||||
public:
|
public:
|
||||||
static void setLabelAsNotice(QLabel& label, bool is_warning);
|
static void setLabelAsNotice(QLabel& label, bool is_warning);
|
||||||
static void applyDialogProperties(QWidget& widget, const QIcon& icon, const QString& title = QString());
|
static void applyDialogProperties(QWidget& widget, const QIcon& icon, const QString& title = QString());
|
||||||
|
static void applyResponsiveDialogResize(QWidget& widget, double factor = 0.6);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit GuiUtilities();
|
explicit GuiUtilities();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user