Browse Source

- Fixed (workaround, maybe Qt's bug?) for transfers list background painting problem.

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
a5ac742c1f
  1. 1
      TODO
  2. 13
      src/DLListDelegate.h
  3. 13
      src/FinishedListDelegate.h
  4. 99
      src/MainWindow.ui

1
TODO

@ -42,7 +42,6 @@
- Windows port (Chris - Peerkoel) - Windows port (Chris - Peerkoel)
- Translations update - Translations update
- Optimize and cleanup code - Optimize and cleanup code
- check painting problems in dl list
- Wait for some bug fixes in libtorrent : - Wait for some bug fixes in libtorrent :
- upload/download limit per torrent - upload/download limit per torrent
- double free or corruption on exit - double free or corruption on exit

13
src/DLListDelegate.h

@ -72,10 +72,15 @@ class DLListDelegate: public QAbstractItemDelegate {
} }
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight)); painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight));
}else{ }else{
value = index.data(Qt::BackgroundColorRole); painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Base));
if (value.isValid() && qvariant_cast<QColor>(value).isValid()){ // The following should work but is broken (retry with future versions of Qt)
painter->fillRect(option.rect, qvariant_cast<QColor>(value)); // QVariant value = index.data(Qt::BackgroundRole);
} // if (qVariantCanConvert<QBrush>(value)) {
// QPointF oldBO = painter->brushOrigin();
// painter->setBrushOrigin(option.rect.topLeft());
// painter->fillRect(option.rect, qvariant_cast<QBrush>(value));
// painter->setBrushOrigin(oldBO);
// }
} }
} }
switch(index.column()){ switch(index.column()){

13
src/FinishedListDelegate.h

@ -70,10 +70,15 @@ class FinishedListDelegate: public QAbstractItemDelegate {
} }
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight)); painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight));
}else{ }else{
value = index.data(Qt::BackgroundColorRole); painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Base));
if (value.isValid() && qvariant_cast<QColor>(value).isValid()){ // The following should work but is broken (retry with future versions of Qt)
painter->fillRect(option.rect, qvariant_cast<QColor>(value)); // QVariant value = index.data(Qt::BackgroundRole);
} // if (qVariantCanConvert<QBrush>(value)) {
// QPointF oldBO = painter->brushOrigin();
// painter->setBrushOrigin(option.rect.topLeft());
// painter->fillRect(option.rect, qvariant_cast<QBrush>(value));
// painter->setBrushOrigin(oldBO);
// }
} }
} }
switch(index.column()){ switch(index.column()){

99
src/MainWindow.ui

@ -17,12 +17,21 @@
</property> </property>
<widget class="QWidget" name="centralwidget" > <widget class="QWidget" name="centralwidget" >
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QTabWidget" name="tabs" > <widget class="QTabWidget" name="tabs" >
<property name="tabPosition" > <property name="tabPosition" >
@ -36,28 +45,55 @@
<string>Downloads</string> <string>Downloads</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
@ -275,18 +311,25 @@
<string>Log</string> <string>Log</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QTextBrowser" name="infoBar" > <widget class="QTextBrowser" name="infoBar" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -309,12 +352,21 @@
<string>IP filter</string> <string>IP filter</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QTextBrowser" name="textBlockedUsers" > <widget class="QTextBrowser" name="textBlockedUsers" >
<property name="maximumSize" > <property name="maximumSize" >
@ -408,7 +460,10 @@
</size> </size>
</property> </property>
<attribute name="toolBarArea" > <attribute name="toolBarArea" >
<number>4</number> <enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak" >
<bool>false</bool>
</attribute> </attribute>
<addaction name="actionOpen" /> <addaction name="actionOpen" />
<addaction name="actionDownload_from_URL" /> <addaction name="actionDownload_from_URL" />

Loading…
Cancel
Save