replaced with togglebutton using qtquickcontrols2

This commit is contained in:
Jedi18 2021-02-13 23:59:42 +05:30
parent 4996ae27a0
commit 1a406f79e6
4 changed files with 28 additions and 19 deletions

View file

@ -1,22 +1,32 @@
import QtQuick 2.5 import QtQuick 2.5
import QtQuick.Controls 1.4 import QtQuick 2.12
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls 2.12
import im.nheko 1.0 import im.nheko 1.0
Switch { Switch {
style: SwitchStyle { id: toggleButton
handle: Rectangle {
width: 20 indicator: Item {
height: 20 implicitWidth: 48
radius: 90 implicitHeight: 26
color: "whitesmoke"
Rectangle {
height: parent.height/2
radius: height/2
width: parent.width - height
x: radius
y: parent.height / 2 - height / 2
color: toggleButton.checked ? "skyblue" : "grey"
border.color: "#cccccc"
} }
groove: Rectangle { Rectangle {
implicitWidth: 40 x: toggleButton.checked ? parent.width - width : 0
implicitHeight: 20 width: parent.height
radius: 90 height: width
color: checked ? "skyblue" : "grey" radius: width/2
color: toggleButton.down ? "whitesmoke" : "whitesmoke"
border.color: "#999999"
} }
} }
} }

View file

@ -54,7 +54,6 @@ class LeaveRoom;
class Logout; class Logout;
class MemberList; class MemberList;
class ReCaptcha; class ReCaptcha;
class RoomSettingsOld;
} }
class MainWindow : public QMainWindow class MainWindow : public QMainWindow

View file

@ -11,8 +11,8 @@
#include "CacheCryptoStructs.h" #include "CacheCryptoStructs.h"
#include "EventStore.h" #include "EventStore.h"
#include "InputBar.h" #include "InputBar.h"
#include "ui/UserProfile.h"
#include "ui/RoomSettings.h" #include "ui/RoomSettings.h"
#include "ui/UserProfile.h"
namespace mtx::http { namespace mtx::http {
using RequestErr = const std::optional<mtx::http::ClientError> &; using RequestErr = const std::optional<mtx::http::ClientError> &;

View file

@ -1,21 +1,21 @@
#include "RoomSettings.h" #include "RoomSettings.h"
#include <QApplication>
#include <QFileDialog> #include <QFileDialog>
#include <QHBoxLayout>
#include <QImageReader> #include <QImageReader>
#include <QMimeDatabase> #include <QMimeDatabase>
#include <QStandardPaths> #include <QStandardPaths>
#include <QHBoxLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QApplication>
#include <mtx/responses/common.hpp> #include <mtx/responses/common.hpp>
#include <mtx/responses/media.hpp> #include <mtx/responses/media.hpp>
#include "Cache.h" #include "Cache.h"
#include "Logging.h"
#include "Config.h" #include "Config.h"
#include "Logging.h"
#include "MatrixClient.h" #include "MatrixClient.h"
#include "ui/TextField.h"
#include "Utils.h" #include "Utils.h"
#include "ui/TextField.h"
using namespace mtx::events; using namespace mtx::events;