diff src/ui_utils.cpp @ 6:1d82f6e04d7d

Update: add first parts to the settings dialog
author Paper <mrpapersonic@gmail.com>
date Wed, 16 Aug 2023 00:49:17 -0400
parents 23d0d9319a00
children 07a9095eaeed
line wrap: on
line diff
--- a/src/ui_utils.cpp	Sat Aug 12 13:10:34 2023 -0400
+++ b/src/ui_utils.cpp	Wed Aug 16 00:49:17 2023 -0400
@@ -6,6 +6,14 @@
 #include "sys/win32/dark_theme.h"
 #endif
 
+QIcon UiUtils::CreateSideBarIcon(const char* file) {
+	QPixmap pixmap(file, "PNG");
+	QIcon result;
+	result.addPixmap(pixmap, QIcon::Normal);
+	result.addPixmap(pixmap, QIcon::Selected);
+	return result;
+}
+
 bool UiUtils::IsInDarkMode() {
 	if (session.config.theme != OS)
 		return (session.config.theme == DARK);
@@ -48,8 +56,12 @@
 
 	QPlainTextEdit* paragraph = new QPlainTextEdit(data, parent);
 	paragraph->setTextInteractionFlags(Qt::NoTextInteraction);
+	paragraph->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents);
 	paragraph->setWordWrapMode(QTextOption::NoWrap);
 	paragraph->setFrameShape(QFrame::NoFrame);
+	paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+	paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+	paragraph->setStyleSheet("background: transparent;");
 	paragraph->move(point.x()+12, point.y()+32);
 	paragraph->resize(size.width()-12, size.height()-32);
 	return paragraph;
@@ -60,15 +72,23 @@
 
 	QPlainTextEdit* label_t = new QPlainTextEdit(label, parent);
 	label_t->setTextInteractionFlags(Qt::NoTextInteraction);
+	label_t->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents);
 	label_t->setWordWrapMode(QTextOption::NoWrap);
 	label_t->setFrameShape(QFrame::NoFrame);
+	label_t->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+	label_t->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+	label_t->setStyleSheet("background: transparent;");
 	label_t->move(point.x()+12, point.y()+32);
 	label_t->resize(90, size.height()-32);
 
 	QPlainTextEdit* paragraph = new QPlainTextEdit(data, parent);
 	paragraph->setTextInteractionFlags(Qt::NoTextInteraction);
+	paragraph->setAttribute(Qt::WidgetAttribute::WA_TransparentForMouseEvents);
 	paragraph->setWordWrapMode(QTextOption::NoWrap);
 	paragraph->setFrameShape(QFrame::NoFrame);
+	paragraph->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+	paragraph->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+	paragraph->setStyleSheet("background: transparent;");
 	paragraph->move(point.x()+102, point.y()+32);
 	paragraph->resize(size.width()-102, size.height()-32);
 	return paragraph;
@@ -82,6 +102,9 @@
 	QPlainTextEdit* text_edit = new QPlainTextEdit(data, parent);
 	text_edit->setReadOnly(true);
 	text_edit->setFrameShape(QFrame::NoFrame);
+	text_edit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+	text_edit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+	text_edit->setStyleSheet("background: transparent;");
 	text_edit->move(point.x()+12, point.y()+32);
 	text_edit->resize(size.width()-12, size.height()-32);
 	return text_edit;