From d557c7cf8f3a91aee972946ac356ee419ff9c8f4 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Thu, 24 Mar 2016 21:52:27 +0300 Subject: [PATCH] scrollbars fix --- src/list_items.py | 16 +++++++++------- src/loginscreen.py | 9 --------- src/mainscreen.py | 3 +++ src/styles/style.qss | 15 +++++++++++++++ 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/list_items.py b/src/list_items.py index 59ba66e..f1412d1 100644 --- a/src/list_items.py +++ b/src/list_items.py @@ -6,6 +6,7 @@ from util import curr_directory class MessageEdit(QtGui.QPlainTextEdit): + def __init__(self, text, width, parent=None): super(MessageEdit, self).__init__(parent) self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) @@ -34,12 +35,12 @@ class MessageEdit(QtGui.QPlainTextEdit): self.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse | QtCore.Qt.LinksAccessibleByMouse) -class MessageItem(QtGui.QListWidget): +class MessageItem(QtGui.QWidget): """ Message in messages list """ def __init__(self, text, time, user='', message_type=TOX_MESSAGE_TYPE['NORMAL'], parent=None): - QtGui.QListWidget.__init__(self, parent) + QtGui.QWidget.__init__(self, parent) self.name = QtGui.QLabel(self) self.name.setGeometry(QtCore.QRect(0, 2, 95, 20)) self.name.setTextFormat(QtCore.Qt.PlainText) @@ -80,12 +81,12 @@ class MessageItem(QtGui.QListWidget): return max(self.h, 25) -class ContactItem(QtGui.QListWidget): +class ContactItem(QtGui.QWidget): """ Contact in friends list """ def __init__(self, parent=None): - QtGui.QListWidget.__init__(self, parent) + QtGui.QWidget.__init__(self, parent) self.setBaseSize(QtCore.QSize(250, 70)) self.avatar_label = QtGui.QLabel(self) self.avatar_label.setGeometry(QtCore.QRect(3, 3, 64, 64)) @@ -148,11 +149,12 @@ class StatusCircle(QtGui.QWidget): paint.end() -class FileTransferItem(QtGui.QListWidget): +class FileTransferItem(QtGui.QWidget): + def __init__(self, file_name, size, time, user, friend_number, file_number, show_accept, parent=None): - QtGui.QListWidget.__init__(self, parent) + QtGui.QWidget.__init__(self, parent) self.resize(QtCore.QSize(600, 50)) - self.setStyleSheet('QListWidget { background-color: green; }') + self.setStyleSheet('QWidget { background-color: green; }') self.name = QtGui.QLabel(self) self.name.setGeometry(QtCore.QRect(0, 15, 95, 20)) diff --git a/src/loginscreen.py b/src/loginscreen.py index 3cced1d..4aa5347 100644 --- a/src/loginscreen.py +++ b/src/loginscreen.py @@ -12,37 +12,28 @@ class LoginScreen(QtGui.QWidget): self.initUI() def initUI(self): - self.setObjectName("login") self.resize(400, 200) self.setMinimumSize(QtCore.QSize(400, 200)) self.setMaximumSize(QtCore.QSize(400, 200)) self.setBaseSize(QtCore.QSize(400, 200)) self.new_profile = QtGui.QPushButton(self) self.new_profile.setGeometry(QtCore.QRect(20, 150, 171, 27)) - self.new_profile.setObjectName("new_profile") self.new_profile.clicked.connect(self.create_profile) self.label = QtGui.QLabel(self) self.label.setGeometry(QtCore.QRect(20, 70, 101, 17)) - self.label.setObjectName("label") self.new_name = QtGui.QPlainTextEdit(self) self.new_name.setGeometry(QtCore.QRect(20, 100, 171, 31)) - self.new_name.setObjectName("new_name") self.load_profile = QtGui.QPushButton(self) self.load_profile.setGeometry(QtCore.QRect(220, 150, 161, 27)) - self.load_profile.setObjectName("load_profile") self.load_profile.clicked.connect(self.load_ex_profile) self.default = QtGui.QCheckBox(self) self.default.setGeometry(QtCore.QRect(220, 110, 131, 22)) - self.default.setObjectName("default") self.groupBox = QtGui.QGroupBox(self) self.groupBox.setGeometry(QtCore.QRect(210, 40, 181, 151)) - self.groupBox.setObjectName("groupBox") self.comboBox = QtGui.QComboBox(self.groupBox) self.comboBox.setGeometry(QtCore.QRect(10, 30, 161, 27)) - self.comboBox.setObjectName("comboBox") self.groupBox_2 = QtGui.QGroupBox(self) self.groupBox_2.setGeometry(QtCore.QRect(10, 40, 191, 151)) - self.groupBox_2.setObjectName("groupBox_2") self.toxygen = QtGui.QLabel(self) self.groupBox.raise_() self.groupBox_2.raise_() diff --git a/src/mainscreen.py b/src/mainscreen.py index 0ea3af1..df74796 100644 --- a/src/mainscreen.py +++ b/src/mainscreen.py @@ -200,15 +200,18 @@ class MainWindow(QtGui.QMainWindow): def setup_left_center(self, widget): self.friends_list = QtGui.QListWidget(widget) + self.friends_list.setObjectName("friends_list") self.friends_list.setGeometry(0, 0, 270, 250) self.friends_list.clicked.connect(self.friend_click) self.friends_list.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.friends_list.connect(self.friends_list, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.friend_right_click) + self.friends_list.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel) def setup_right_center(self, widget): self.messages = QtGui.QListWidget(widget) self.messages.setGeometry(0, 0, 620, 250) + self.messages.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel) def initUI(self, tox): self.setMinimumSize(920, 520) diff --git a/src/styles/style.qss b/src/styles/style.qss index 4d32c95..1a156f9 100644 --- a/src/styles/style.qss +++ b/src/styles/style.qss @@ -1251,3 +1251,18 @@ QPushButton:hover { background-color: #4A4949; } + +QListWidget QListWidgetItem:selected +{ + background-color: #4A4949; +} + +#friends_list:item:selected +{ + background-color: #A9A9A9; +} + +#toxygen +{ + color: #006400; +}