1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 08:13:27 +00:00

(trunk, qt) #4624 "Inconsistent behavior when clicking on items at the torrent list" -- apply a nice patch by dirleyrls

This commit is contained in:
Jordan Lee 2012-08-18 15:39:11 +00:00
parent a06a48dad3
commit 4f4529ae09

View file

@ -46,6 +46,27 @@
#define PREFS_KEY "prefs-key";
/**
* This is a proxy-style for that forces it to be always disabled.
* We use this to make our torrent list view behave consistently on
* both GTK and Qt implementations.
*/
class ListViewProxyStyle: public QProxyStyle
{
public:
int styleHint(StyleHint hint,
const QStyleOption *option = 0,
const QWidget *widget = 0,
QStyleHintReturn *returnData = 0) const
{
if (hint == QStyle::SH_ItemView_ActivateItemOnSingleClick)
return 0;
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
};
QIcon
TrMainWindow :: getStockIcon( const QString& name, int fallback )
{
@ -106,6 +127,8 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
int i = style->pixelMetric( QStyle::PM_SmallIconSize, 0, this );
const QSize smallIconSize( i, i );
ui.listView->setStyle(new ListViewProxyStyle);
// icons
ui.action_OpenFile->setIcon( getStockIcon( "folder-open", QStyle::SP_DialogOpenButton ) );
ui.action_New->setIcon( getStockIcon( "document-new", QStyle::SP_DesktopIcon ) );
@ -171,6 +194,7 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
connect( ui.action_SetLocation, SIGNAL(triggered()), this, SLOT(setLocation()));
connect( ui.action_Properties, SIGNAL(triggered()), this, SLOT(openProperties()));
connect( ui.action_SessionDialog, SIGNAL(triggered()), mySessionDialog, SLOT(show()));
connect( ui.listView, SIGNAL(activated(const QModelIndex&)), ui.action_Properties, SLOT(trigger()));
// signals