From d35cc3dda4dc08dd16d9d12d5f96863d831fd6c7 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 28 Mar 2020 19:12:00 +0100 Subject: Use palette for qml code for theming Can't do it for QtWidgets code. We need to fully transition, before we can fully switch over probably. --- src/Logging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Logging.cpp') diff --git a/src/Logging.cpp b/src/Logging.cpp index 5d64a630..2d821cce 100644 --- a/src/Logging.cpp +++ b/src/Logging.cpp @@ -29,7 +29,7 @@ qmlMessageHandler(QtMsgType type, const QMessageLogContext &context, const QStri if (msg.endsWith( "QML Binding: Not restoring previous value because restoreMode has not been set.This " "behavior is deprecated.In Qt < 6.0 the default is Binding.RestoreBinding.In Qt >= " - "6.0 the default is Binding.RestoreBindingOrValue.")) + "6.0 the default is Binding.RestoreBindingOrValue.") || msg.endsWith("Both point size and pixel size set. Using pixel size.")) return; switch (type) { -- cgit 1.5.1 From 31a5972f2accf6a3ffe9afcb11b2387fa588908d Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 31 Mar 2020 00:38:17 +0200 Subject: Fix UserProfile resizing --- src/Logging.cpp | 3 ++- src/dialogs/UserProfile.cpp | 19 +++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src/Logging.cpp') diff --git a/src/Logging.cpp b/src/Logging.cpp index 2d821cce..f0c570a5 100644 --- a/src/Logging.cpp +++ b/src/Logging.cpp @@ -29,7 +29,8 @@ qmlMessageHandler(QtMsgType type, const QMessageLogContext &context, const QStri if (msg.endsWith( "QML Binding: Not restoring previous value because restoreMode has not been set.This " "behavior is deprecated.In Qt < 6.0 the default is Binding.RestoreBinding.In Qt >= " - "6.0 the default is Binding.RestoreBindingOrValue.") || msg.endsWith("Both point size and pixel size set. Using pixel size.")) + "6.0 the default is Binding.RestoreBindingOrValue.") || + msg.endsWith("Both point size and pixel size set. Using pixel size.")) return; switch (type) { diff --git a/src/dialogs/UserProfile.cpp b/src/dialogs/UserProfile.cpp index f1dd77df..3415b127 100644 --- a/src/dialogs/UserProfile.cpp +++ b/src/dialogs/UserProfile.cpp @@ -142,8 +142,6 @@ UserProfile::UserProfile(QWidget *parent) devices_->setSelectionMode(QAbstractItemView::NoSelection); devices_->setAttribute(Qt::WA_MacShowFocusRect, 0); devices_->setSpacing(DEVICE_SPACING); - devices_->setMinimumHeight(devices_->sizeHint().height() * 1.2); - devices_->hide(); QFont descriptionLabelFont; descriptionLabelFont.setWeight(65); @@ -151,6 +149,7 @@ UserProfile::UserProfile(QWidget *parent) devicesLabel_ = new QLabel(tr("Devices").toUpper(), this); devicesLabel_->setFont(descriptionLabelFont); devicesLabel_->hide(); + devicesLabel_->setFixedSize(devicesLabel_->sizeHint()); auto okBtn = new QPushButton("OK", this); @@ -160,29 +159,24 @@ UserProfile::UserProfile(QWidget *parent) closeLayout->addWidget(okBtn); auto vlayout = new QVBoxLayout{this}; - vlayout->addWidget(avatar_); + vlayout->addWidget(avatar_, 0, Qt::AlignCenter | Qt::AlignTop); vlayout->addLayout(textLayout); vlayout->addLayout(btnLayout); - vlayout->addWidget(devicesLabel_, Qt::AlignLeft); - vlayout->addWidget(devices_); + vlayout->addWidget(devicesLabel_, 0, Qt::AlignLeft); + vlayout->addWidget(devices_, 1); vlayout->addLayout(closeLayout); - vlayout->addStretch(1); - - vlayout->setAlignment(avatar_, Qt::AlignCenter | Qt::AlignTop); - vlayout->setAlignment(userIdLabel_, Qt::AlignCenter | Qt::AlignTop); QFont largeFont; largeFont.setPointSizeF(largeFont.pointSizeF() * 1.5); setMinimumWidth( std::max(devices_->sizeHint().width() + 4 * WIDGET_MARGIN, conf::window::minModalWidth)); - setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); + setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); vlayout->setSpacing(WIDGET_SPACING); vlayout->setContentsMargins(WIDGET_MARGIN, TOP_WIDGET_MARGIN, WIDGET_MARGIN, WIDGET_MARGIN); - static auto ignored = qRegisterMetaType>(); - (void)ignored; + qRegisterMetaType>(); auto closeShortcut = new QShortcut(QKeySequence(QKeySequence::Cancel), this); connect(closeShortcut, &QShortcut::activated, this, &UserProfile::close); @@ -307,4 +301,5 @@ UserProfile::updateDeviceList(const QString &user_id, const std::vectorshow(); devices_->show(); + adjustSize(); } -- cgit 1.5.1 From 4fa12b52aad67f9500f036c96aa52cf8406e0cb6 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 8 Apr 2020 23:12:18 +0200 Subject: Add comment on why we surpress some of those log messages --- src/Logging.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/Logging.cpp') diff --git a/src/Logging.cpp b/src/Logging.cpp index f0c570a5..b63c2e5a 100644 --- a/src/Logging.cpp +++ b/src/Logging.cpp @@ -25,12 +25,18 @@ qmlMessageHandler(QtMsgType type, const QMessageLogContext &context, const QStri const char *file = context.file ? context.file : ""; const char *function = context.function ? context.function : ""; - // Surpress binding wrning for now, as we can't set restore mode to keep compat with qt 5.10 - if (msg.endsWith( - "QML Binding: Not restoring previous value because restoreMode has not been set.This " - "behavior is deprecated.In Qt < 6.0 the default is Binding.RestoreBinding.In Qt >= " - "6.0 the default is Binding.RestoreBindingOrValue.") || - msg.endsWith("Both point size and pixel size set. Using pixel size.")) + if ( + // Surpress binding wrning for now, as we can't set restore mode to keep compat with + // qt 5.10 + msg.endsWith( + "QML Binding: Not restoring previous value because restoreMode has not been set.This " + "behavior is deprecated.In Qt < 6.0 the default is Binding.RestoreBinding.In Qt >= " + "6.0 the default is Binding.RestoreBindingOrValue.") || + // The default style has the point size set. If you use pixel size anywhere, you get + // that warning, which is useless, since sometimes you need the pixel size to match the + // text to the size of the outer element for example. This is done in the avatar and + // without that you get one warning for every Avatar displayed, which is stupid! + msg.endsWith("Both point size and pixel size set. Using pixel size.")) return; switch (type) { -- cgit 1.5.1