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

13
src/DLListDelegate.h

@ -72,10 +72,15 @@ class DLListDelegate: public QAbstractItemDelegate { @@ -72,10 +72,15 @@ class DLListDelegate: public QAbstractItemDelegate {
}
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight));
}else{
value = index.data(Qt::BackgroundColorRole);
if (value.isValid() && qvariant_cast<QColor>(value).isValid()){
painter->fillRect(option.rect, qvariant_cast<QColor>(value));
}
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Base));
// The following should work but is broken (retry with future versions of Qt)
// 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()){

13
src/FinishedListDelegate.h

@ -70,10 +70,15 @@ class FinishedListDelegate: public QAbstractItemDelegate { @@ -70,10 +70,15 @@ class FinishedListDelegate: public QAbstractItemDelegate {
}
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight));
}else{
value = index.data(Qt::BackgroundColorRole);
if (value.isValid() && qvariant_cast<QColor>(value).isValid()){
painter->fillRect(option.rect, qvariant_cast<QColor>(value));
}
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Base));
// The following should work but is broken (retry with future versions of Qt)
// 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()){

99
src/MainWindow.ui

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

Loading…
Cancel
Save