Code maintenance for Qt 5:

- Added new options to retroshare-gui.pro for Qt 5
- Added new file QtVersion.h with macros to compile with Qt 4 and Qt 5
  - QHeaderView::setResizeMode -> QHeaderView::setSectionResizeMode
  - QHeaderView::setMovable -> QHeaderView::setSectionsMovable

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6849 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-10-19 13:25:06 +00:00
parent 230caadb89
commit 6dbcc3e99b
18 changed files with 139 additions and 74 deletions

View File

@ -221,7 +221,7 @@ void AWidget::timerEvent(QTimerEvent* e) {
page ^= 1; page ^= 1;
if (qrand() % 128 == 0) { if (qrand() % 128 == 0) {
int r = 3 + qRound(qrand() * 4 / RAND_MAX); int r = 3 + qRound((double) qrand() * 4 / RAND_MAX);
int h = 300 + qrand() * 200 / RAND_MAX; int h = 300 + qrand() * 200 / RAND_MAX;
int x = 1 + r + qrand()%(image1.width() -2*r-1); int x = 1 + r + qrand()%(image1.width() -2*r-1);
int y = 1 + r + qrand()%(image1.height()-2*r-1); int y = 1 + r + qrand()%(image1.height()-2*r-1);

View File

@ -11,6 +11,7 @@
#include "notifyqt.h" #include "notifyqt.h"
#include "chat/ChatLobbyDialog.h" #include "chat/ChatLobbyDialog.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/QtVersion.h"
#include <gui/settings/rsharesettings.h> #include <gui/settings/rsharesettings.h>
#include "retroshare/rsmsgs.h" #include "retroshare/rsmsgs.h"
@ -83,10 +84,10 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
headerItem->setTextAlignment(COLUMN_SUBSCRIBED, Qt::AlignHCenter | Qt::AlignVCenter); headerItem->setTextAlignment(COLUMN_SUBSCRIBED, Qt::AlignHCenter | Qt::AlignVCenter);
QHeaderView *header = lobbyTreeWidget->header(); QHeaderView *header = lobbyTreeWidget->header();
header->setResizeMode(COLUMN_NAME, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(header, COLUMN_NAME, QHeaderView::Interactive);
header->setResizeMode(COLUMN_USER_COUNT, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(header, COLUMN_USER_COUNT, QHeaderView::Interactive);
header->setResizeMode(COLUMN_TOPIC, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(header, COLUMN_TOPIC, QHeaderView::Interactive);
header->setResizeMode(COLUMN_SUBSCRIBED, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(header, COLUMN_SUBSCRIBED, QHeaderView::Interactive);
privateSubLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER); privateSubLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
privateSubLobbyItem->setText(COLUMN_NAME, tr("Private Subscribed Lobbies")); privateSubLobbyItem->setText(COLUMN_NAME, tr("Private Subscribed Lobbies"));

View File

@ -54,6 +54,7 @@
#include "util/misc.h" #include "util/misc.h"
#include <gui/common/RsCollectionFile.h> #include <gui/common/RsCollectionFile.h>
#include "TransferUserNotify.h" #include "TransferUserNotify.h"
#include "util/QtVersion.h"
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
@ -236,19 +237,19 @@ TransfersDialog::TransfersDialog(QWidget *parent)
/* Set header resize modes and initial section sizes Downloads TreeView*/ /* Set header resize modes and initial section sizes Downloads TreeView*/
QHeaderView * _header = ui.downloadList->header () ; QHeaderView * _header = ui.downloadList->header () ;
_header->setResizeMode (COLUMN_NAME, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_NAME, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_SIZE, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_SIZE, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_COMPLETED, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_COMPLETED, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_DLSPEED, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_DLSPEED, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_PROGRESS, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_PROGRESS, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_SOURCES, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_SOURCES, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_STATUS, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_STATUS, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_PRIORITY, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_PRIORITY, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_REMAINING, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_REMAINING, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_DOWNLOADTIME, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_DOWNLOADTIME, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_ID, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_ID, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_LASTDL, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_LASTDL, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_PATH, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_PATH, QHeaderView::Interactive);
_header->resizeSection ( COLUMN_NAME, 170 ); _header->resizeSection ( COLUMN_NAME, 170 );
_header->resizeSection ( COLUMN_SIZE, 70 ); _header->resizeSection ( COLUMN_SIZE, 70 );
@ -299,13 +300,13 @@ TransfersDialog::TransfersDialog(QWidget *parent)
/* Set header resize modes and initial section sizes Uploads TreeView*/ /* Set header resize modes and initial section sizes Uploads TreeView*/
QHeaderView * upheader = ui.uploadsList->header () ; QHeaderView * upheader = ui.uploadsList->header () ;
upheader->setResizeMode (COLUMN_UNAME, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(upheader, COLUMN_UNAME, QHeaderView::Interactive);
upheader->setResizeMode (COLUMN_USIZE, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(upheader, COLUMN_USIZE, QHeaderView::Interactive);
upheader->setResizeMode (COLUMN_UTRANSFERRED, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(upheader, COLUMN_UTRANSFERRED, QHeaderView::Interactive);
upheader->setResizeMode (COLUMN_ULSPEED, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(upheader, COLUMN_ULSPEED, QHeaderView::Interactive);
upheader->setResizeMode (COLUMN_UPROGRESS, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(upheader, COLUMN_UPROGRESS, QHeaderView::Interactive);
upheader->setResizeMode (COLUMN_USTATUS, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(upheader, COLUMN_USTATUS, QHeaderView::Interactive);
upheader->setResizeMode (COLUMN_USERNAME, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(upheader, COLUMN_USERNAME, QHeaderView::Interactive);
upheader->resizeSection ( COLUMN_UNAME, 190 ); upheader->resizeSection ( COLUMN_UNAME, 190 );
upheader->resizeSection ( COLUMN_USIZE, 70 ); upheader->resizeSection ( COLUMN_USIZE, 70 );

View File

@ -43,6 +43,7 @@
#include "notifyqt.h" #include "notifyqt.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include "util/QtVersion.h"
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
@ -154,7 +155,7 @@ ForumsDialog::ForumsDialog(QWidget *parent)
/* Set header resize modes and initial section sizes */ /* Set header resize modes and initial section sizes */
QHeaderView * ttheader = ui.threadTreeWidget->header () ; QHeaderView * ttheader = ui.threadTreeWidget->header () ;
ttheader->setResizeMode (COLUMN_THREAD_TITLE, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(ttheader, COLUMN_THREAD_TITLE, QHeaderView::Interactive);
ttheader->resizeSection (COLUMN_THREAD_DATE, 140); ttheader->resizeSection (COLUMN_THREAD_DATE, 140);
ttheader->resizeSection (COLUMN_THREAD_TITLE, 290); ttheader->resizeSection (COLUMN_THREAD_TITLE, 290);
@ -191,7 +192,7 @@ ForumsDialog::ForumsDialog(QWidget *parent)
/* Set header sizes for the fixed columns and resize modes, must be set after processSettings */ /* Set header sizes for the fixed columns and resize modes, must be set after processSettings */
ttheader->resizeSection (COLUMN_THREAD_READ, 24); ttheader->resizeSection (COLUMN_THREAD_READ, 24);
ttheader->setResizeMode (COLUMN_THREAD_READ, QHeaderView::Fixed); QHeaderView_setSectionResizeMode(ttheader, COLUMN_THREAD_READ, QHeaderView::Fixed);
ttheader->hideSection (COLUMN_THREAD_CONTENT); ttheader->hideSection (COLUMN_THREAD_CONTENT);
ui.progressBar->hide(); ui.progressBar->hide();
@ -1278,7 +1279,7 @@ void ForumsDialog::nextUnreadMessage()
{ {
QTreeWidgetItem *currentItem = ui.threadTreeWidget->currentItem(); QTreeWidgetItem *currentItem = ui.threadTreeWidget->currentItem();
while (TRUE) { while (true) {
QTreeWidgetItemIterator itemIterator = currentItem ? QTreeWidgetItemIterator(currentItem, QTreeWidgetItemIterator::NotHidden) : QTreeWidgetItemIterator(ui.threadTreeWidget, QTreeWidgetItemIterator::NotHidden); QTreeWidgetItemIterator itemIterator = currentItem ? QTreeWidgetItemIterator(currentItem, QTreeWidgetItemIterator::NotHidden) : QTreeWidgetItemIterator(ui.threadTreeWidget, QTreeWidgetItemIterator::NotHidden);
QTreeWidgetItem *item; QTreeWidgetItem *item;

View File

@ -103,11 +103,11 @@ void GenCertDialog::grabMouse()
RsInit::collectEntropy(E+(F << 16)) ; RsInit::collectEntropy(E+(F << 16)) ;
} }
static bool MyEventFilter(void *message, long *result) //static bool MyEventFilter(void *message, long *result)
{ //{
std::cerr << "Event called " << message << std::endl; // std::cerr << "Event called " << message << std::endl;
return false ; // return false ;
} //}
/** Default constructor */ /** Default constructor */
GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent) GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mOnlyGenerateIdentity(onlyGenerateIdentity) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mOnlyGenerateIdentity(onlyGenerateIdentity)

View File

@ -37,6 +37,7 @@
#include "common/RSItemDelegate.h" #include "common/RSItemDelegate.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include "util/RsProtectedTimer.h" #include "util/RsProtectedTimer.h"
#include "util/QtVersion.h"
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
@ -210,7 +211,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
msgwheader->resizeSection (COLUMN_DATE, 140); msgwheader->resizeSection (COLUMN_DATE, 140);
msgwheader->resizeSection (COLUMN_STAR, 16); msgwheader->resizeSection (COLUMN_STAR, 16);
msgwheader->setResizeMode (COLUMN_STAR, QHeaderView::Fixed); QHeaderView_setSectionResizeMode(msgwheader, COLUMN_STAR, QHeaderView::Fixed);
msgwheader->resizeSection (COLUMN_STAR, 24); msgwheader->resizeSection (COLUMN_STAR, 24);
ui.forwardmessageButton->setToolTip(tr("Forward selected Message")); ui.forwardmessageButton->setToolTip(tr("Forward selected Message"));
@ -243,14 +244,14 @@ MessagesDialog::MessagesDialog(QWidget *parent)
processSettings(true); processSettings(true);
/* Set header sizes for the fixed columns and resize modes, must be set after processSettings */ /* Set header sizes for the fixed columns and resize modes, must be set after processSettings */
msgwheader->setResizeMode (COLUMN_ATTACHEMENTS, QHeaderView::Fixed); QHeaderView_setSectionResizeMode(msgwheader, COLUMN_ATTACHEMENTS, QHeaderView::Fixed);
msgwheader->setResizeMode (COLUMN_DATE, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(msgwheader, COLUMN_DATE, QHeaderView::Interactive);
msgwheader->setResizeMode (COLUMN_UNREAD, QHeaderView::Fixed); QHeaderView_setSectionResizeMode(msgwheader, COLUMN_UNREAD, QHeaderView::Fixed);
msgwheader->setResizeMode (COLUMN_SIGNATURE, QHeaderView::Fixed); QHeaderView_setSectionResizeMode(msgwheader, COLUMN_SIGNATURE, QHeaderView::Fixed);
msgwheader->resizeSection (COLUMN_UNREAD, 24); msgwheader->resizeSection (COLUMN_UNREAD, 24);
msgwheader->resizeSection (COLUMN_SIGNATURE, 24); msgwheader->resizeSection (COLUMN_SIGNATURE, 24);
msgwheader->resizeSection (COLUMN_STAR, 24); msgwheader->resizeSection (COLUMN_STAR, 24);
msgwheader->setResizeMode (COLUMN_STAR, QHeaderView::Fixed); QHeaderView_setSectionResizeMode(msgwheader, COLUMN_STAR, QHeaderView::Fixed);
msgwheader->setStretchLastSection(false); msgwheader->setStretchLastSection(false);
// fill folder list // fill folder list

View File

@ -41,6 +41,7 @@
#include "connect/ConfCertDialog.h" #include "connect/ConfCertDialog.h"
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "RetroShareLink.h" #include "RetroShareLink.h"
#include "util/QtVersion.h"
#include <time.h> #include <time.h>
@ -95,12 +96,12 @@ NetworkDialog::NetworkDialog(QWidget *parent)
/* Set header resize modes and initial section sizes */ /* Set header resize modes and initial section sizes */
QHeaderView * _header = ui.connectTreeWidget->header () ; QHeaderView * _header = ui.connectTreeWidget->header () ;
_header->setResizeMode (COLUMN_CHECK, QHeaderView::Custom); QHeaderView_setSectionResizeMode(_header, COLUMN_CHECK, QHeaderView::Custom);
_header->setResizeMode (COLUMN_PEERNAME, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_PEERNAME, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_I_AUTH_PEER, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_I_AUTH_PEER, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_PEER_AUTH_ME, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_PEER_AUTH_ME, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_PEERID, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_PEERID, QHeaderView::Interactive);
_header->setResizeMode (COLUMN_LAST_USED, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_header, COLUMN_LAST_USED, QHeaderView::Interactive);
_header->model()->setHeaderData(COLUMN_CHECK, Qt::Horizontal, tr("")); _header->model()->setHeaderData(COLUMN_CHECK, Qt::Horizontal, tr(""));
_header->model()->setHeaderData(COLUMN_PEERNAME, Qt::Horizontal, tr("Name")); _header->model()->setHeaderData(COLUMN_PEERNAME, Qt::Horizontal, tr("Name"));

View File

@ -33,7 +33,7 @@
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rstypes.h> #include <retroshare/rstypes.h>
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "util/QtVersion.h"
QuickStartWizard::QuickStartWizard(QWidget *parent) : QuickStartWizard::QuickStartWizard(QWidget *parent) :
QDialog(parent) QDialog(parent)
@ -59,8 +59,8 @@ QuickStartWizard::QuickStartWizard(QWidget *parent) :
// bool b = rsPeers->getAllowTunnelConnection() ; // bool b = rsPeers->getAllowTunnelConnection() ;
// ui.checkBoxTunnelConnection->setChecked(b) ; // ui.checkBoxTunnelConnection->setChecked(b) ;
ui.shareddirList->horizontalHeader()->setResizeMode( 0,QHeaderView::Stretch); QHeaderView_setSectionResizeMode(ui.shareddirList->horizontalHeader(), 0, QHeaderView::Stretch);
ui.shareddirList->horizontalHeader()->setResizeMode( 2,QHeaderView::Interactive); QHeaderView_setSectionResizeMode(ui.shareddirList->horizontalHeader(), 2, QHeaderView::Interactive);
ui.shareddirList->horizontalHeader()->resizeSection( 0, 360 ); ui.shareddirList->horizontalHeader()->resizeSection( 0, 360 );
ui.shareddirList->horizontalHeader()->setStretchLastSection(false); ui.shareddirList->horizontalHeader()->setStretchLastSection(false);

View File

@ -36,6 +36,7 @@
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "advsearch/advancedsearchdialog.h" #include "advsearch/advancedsearchdialog.h"
#include "common/RSTreeWidgetItem.h" #include "common/RSTreeWidgetItem.h"
#include "util/QtVersion.h"
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <retroshare/rsturtle.h> #include <retroshare/rsturtle.h>
@ -146,17 +147,17 @@ SearchDialog::SearchDialog(QWidget *parent)
ui.searchSummaryWidget->setColumnHidden ( 2, true); ui.searchSummaryWidget->setColumnHidden ( 2, true);
QHeaderView * _smheader = ui.searchSummaryWidget->header () ; QHeaderView * _smheader = ui.searchSummaryWidget->header () ;
_smheader->setResizeMode (0, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_smheader, 0, QHeaderView::Interactive);
_smheader->setResizeMode (1, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_smheader, 1, QHeaderView::Interactive);
_smheader->resizeSection ( 0, 160 ); _smheader->resizeSection ( 0, 160 );
_smheader->resizeSection ( 1, 50 ); _smheader->resizeSection ( 1, 50 );
ui.searchResultWidget->setColumnCount(6); ui.searchResultWidget->setColumnCount(6);
_smheader = ui.searchResultWidget->header () ; _smheader = ui.searchResultWidget->header () ;
_smheader->setResizeMode (0, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_smheader, 0, QHeaderView::Interactive);
_smheader->setResizeMode (1, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_smheader, 1, QHeaderView::Interactive);
_smheader->setResizeMode (2, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(_smheader, 2, QHeaderView::Interactive);
_smheader->resizeSection ( 0, 240 ); _smheader->resizeSection ( 0, 240 );
_smheader->resizeSection ( 1, 75 ); _smheader->resizeSection ( 1, 75 );

View File

@ -25,6 +25,7 @@
#include <QHeaderView> #include <QHeaderView>
#include <QMessageBox> #include <QMessageBox>
#include <QUrl> #include <QUrl>
#include <QMimeData>
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <retroshare/rstypes.h> #include <retroshare/rstypes.h>
@ -36,6 +37,7 @@
#include <gui/common/GroupFlagsWidget.h> #include <gui/common/GroupFlagsWidget.h>
#include "gui/common/GroupDefs.h" #include "gui/common/GroupDefs.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include "util/QtVersion.h"
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_CANCEL ":/images/delete.png" #define IMAGE_CANCEL ":/images/delete.png"
@ -77,7 +79,7 @@ ShareManager::ShareManager()
ui.removeButton->setEnabled(false); ui.removeButton->setEnabled(false);
QHeaderView* header = ui.shareddirList->horizontalHeader(); QHeaderView* header = ui.shareddirList->horizontalHeader();
header->setResizeMode( COLUMN_PATH, QHeaderView::Stretch); QHeaderView_setSectionResizeMode(header, COLUMN_PATH, QHeaderView::Stretch);
//header->setResizeMode(COLUMN_NETWORKWIDE, QHeaderView::Fixed); //header->setResizeMode(COLUMN_NETWORKWIDE, QHeaderView::Fixed);
//header->setResizeMode(COLUMN_BROWSABLE, QHeaderView::Fixed); //header->setResizeMode(COLUMN_BROWSABLE, QHeaderView::Fixed);

View File

@ -39,6 +39,7 @@
#include "RemoteDirModel.h" #include "RemoteDirModel.h"
#include "ShareDialog.h" #include "ShareDialog.h"
#include "common/PeerDefs.h" #include "common/PeerDefs.h"
#include "util/QtVersion.h"
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
@ -330,7 +331,7 @@ void SharedFilesDialog::changeCurrentViewModel(int c)
ui.dirTreeView->update(); ui.dirTreeView->update();
QHeaderView * header = ui.dirTreeView->header () ; QHeaderView * header = ui.dirTreeView->header () ;
header->setResizeMode (0, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(header, 0, QHeaderView::Interactive);
ui.dirTreeView->header()->headerDataChanged(Qt::Horizontal,0,4) ; ui.dirTreeView->header()->headerDataChanged(Qt::Horizontal,0,4) ;

View File

@ -48,6 +48,7 @@
#include "StatusDefs.h" #include "StatusDefs.h"
#include "util/misc.h" #include "util/misc.h"
#include "vmessagebox.h" #include "vmessagebox.h"
#include "util/QtVersion.h"
#include "gui/connect/ConnectProgressDialog.h" #include "gui/connect/ConnectProgressDialog.h"
@ -283,13 +284,13 @@ void FriendList::initializeHeader(bool afterLoadSettings)
{ {
// set column size // set column size
QHeaderView *header = ui->peerTreeWidget->header(); QHeaderView *header = ui->peerTreeWidget->header();
header->setMovable(true); QHeaderView_setSectionsMovable(header, true);
//header->setResizeMode(COLUMN_NAME, QHeaderView::Stretch); //QHeaderView_setSectionResizeMode(header, COLUMN_NAME, QHeaderView::Stretch);
header->setResizeMode(COLUMN_NAME, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(header, COLUMN_NAME, QHeaderView::Interactive);
header->setResizeMode(COLUMN_STATE, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(header, COLUMN_STATE, QHeaderView::Interactive);
header->setResizeMode(COLUMN_LAST_CONTACT, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(header, COLUMN_LAST_CONTACT, QHeaderView::Interactive);
header->setResizeMode(COLUMN_IP, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(header, COLUMN_IP, QHeaderView::Interactive);
header->setResizeMode(COLUMN_AVATAR, QHeaderView::Fixed); QHeaderView_setSectionResizeMode(header, COLUMN_AVATAR, QHeaderView::Fixed);
/* if (!afterLoadSettings) { /* if (!afterLoadSettings) {
header->resizeSection(COLUMN_NAME, 150); header->resizeSection(COLUMN_NAME, 150);

View File

@ -29,6 +29,7 @@
#include "PopularityDefs.h" #include "PopularityDefs.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "RSTreeWidgetItem.h" #include "RSTreeWidgetItem.h"
#include "util/QtVersion.h"
#include <stdint.h> #include <stdint.h>
@ -86,9 +87,9 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
/* Set header resize modes and initial section sizes */ /* Set header resize modes and initial section sizes */
QHeaderView *header = ui->treeWidget->header (); QHeaderView *header = ui->treeWidget->header ();
header->setResizeMode(COLUMN_NAME, QHeaderView::Stretch); QHeaderView_setSectionResizeMode(header, COLUMN_NAME, QHeaderView::Stretch);
header->resizeSection(COLUMN_NAME, 170); header->resizeSection(COLUMN_NAME, 170);
header->setResizeMode(COLUMN_POPULARITY, QHeaderView::Fixed); QHeaderView_setSectionResizeMode(header, COLUMN_POPULARITY, QHeaderView::Fixed);
header->resizeSection(COLUMN_POPULARITY, 25); header->resizeSection(COLUMN_POPULARITY, 25);
/* add filter actions */ /* add filter actions */

View File

@ -60,6 +60,7 @@
#include "gui/common/TagDefs.h" #include "gui/common/TagDefs.h"
#include "gui/connect/ConfCertDialog.h" #include "gui/connect/ConfCertDialog.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/QtVersion.h"
#define IMAGE_GROUP16 ":/images/user/group16.png" #define IMAGE_GROUP16 ":/images/user/group16.png"
#define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png" #define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png"
@ -286,9 +287,9 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
QHeaderView *header = ui.recipientWidget->horizontalHeader(); QHeaderView *header = ui.recipientWidget->horizontalHeader();
header->resizeSection(COLUMN_RECIPIENT_TYPE, 50); header->resizeSection(COLUMN_RECIPIENT_TYPE, 50);
header->resizeSection(COLUMN_RECIPIENT_ICON, 22); header->resizeSection(COLUMN_RECIPIENT_ICON, 22);
header->setResizeMode(COLUMN_RECIPIENT_TYPE, QHeaderView::Fixed); QHeaderView_setSectionResizeMode(header, COLUMN_RECIPIENT_TYPE, QHeaderView::Fixed);
header->setResizeMode(COLUMN_RECIPIENT_ICON, QHeaderView::Fixed); QHeaderView_setSectionResizeMode(header, COLUMN_RECIPIENT_ICON, QHeaderView::Fixed);
header->setResizeMode(COLUMN_RECIPIENT_NAME, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(header, COLUMN_RECIPIENT_NAME, QHeaderView::Interactive);
header->setStretchLastSection(true); header->setStretchLastSection(true);
/* Set own item delegate */ /* Set own item delegate */

View File

@ -42,6 +42,7 @@
#include "util/printpreview.h" #include "util/printpreview.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include "util/QtVersion.h"
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
@ -146,9 +147,9 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f
/* Set header resize modes and initial section sizes */ /* Set header resize modes and initial section sizes */
QHeaderView * msglheader = ui.msgList->header () ; QHeaderView * msglheader = ui.msgList->header () ;
msglheader->setResizeMode (COLUMN_FILE_NAME, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(msglheader, COLUMN_FILE_NAME, QHeaderView::Interactive);
msglheader->setResizeMode (COLUMN_FILE_SIZE, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(msglheader, COLUMN_FILE_SIZE, QHeaderView::Interactive);
msglheader->setResizeMode (COLUMN_FILE_HASH, QHeaderView::Interactive); QHeaderView_setSectionResizeMode(msglheader, COLUMN_FILE_HASH, QHeaderView::Interactive);
msglheader->resizeSection (COLUMN_FILE_NAME, 200); msglheader->resizeSection (COLUMN_FILE_NAME, 200);
msglheader->resizeSection (COLUMN_FILE_SIZE, 100); msglheader->resizeSection (COLUMN_FILE_SIZE, 100);

View File

@ -53,7 +53,11 @@ SoundPage::SoundPage(QWidget * parent, Qt::WindowFlags flags)
headerItem->setText(COLUMN_NAME, tr("Event")); headerItem->setText(COLUMN_NAME, tr("Event"));
headerItem->setText(COLUMN_FILENAME, tr("Filename")); headerItem->setText(COLUMN_FILENAME, tr("Filename"));
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
ui.eventTreeWidget->header()->setSectionResizeMode(QHeaderView::Fixed);
#else
ui.eventTreeWidget->header()->setResizeMode(QHeaderView::Fixed); ui.eventTreeWidget->header()->setResizeMode(QHeaderView::Fixed);
#endif
ui.eventTreeWidget->setTextElideMode(Qt::ElideMiddle); ui.eventTreeWidget->setTextElideMode(Qt::ElideMiddle);
/* Hide platform specific features */ /* Hide platform specific features */

View File

@ -1,4 +1,13 @@
CONFIG += qt gui uic qrc resources uitools idle bitdht QT += network xml script
CONFIG += qt gui uic qrc resources idle bitdht
greaterThan(QT_MAJOR_VERSION, 4) {
# Qt 5
QT += uitools widgets multimedia printsupport
} else {
# Qt 4
CONFIG += uitools
}
# Below is for GXS services. # Below is for GXS services.
# Should be disabled for releases. # Should be disabled for releases.
@ -26,9 +35,6 @@ gxs {
#CONFIG += framecatcher #CONFIG += framecatcher
#CONFIG += blogs #CONFIG += blogs
QT += network xml script
TEMPLATE = app TEMPLATE = app
TARGET = RetroShare TARGET = RetroShare
@ -361,6 +367,7 @@ HEADERS += rshare.h \
util/misc.h \ util/misc.h \
util/HandleRichText.h \ util/HandleRichText.h \
util/ObjectPainter.h \ util/ObjectPainter.h \
util/QtVersion.h \
gui/bwgraph/bwgraph.h \ gui/bwgraph/bwgraph.h \
gui/profile/ProfileWidget.h \ gui/profile/ProfileWidget.h \
gui/profile/ProfileManager.h \ gui/profile/ProfileManager.h \

View File

@ -0,0 +1,41 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2013 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef QTVERSION_H
#define QTVERSION_H
// Macros to compile with Qt 4 and Qt 5
// Renamed QHeaderView::setResizeMode to QHeaderView::setSectionResizeMode
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
#define QHeaderView_setSectionResizeMode(header, column, mode) header->setSectionResizeMode(column, mode);
#else
#define QHeaderView_setSectionResizeMode(header, column, mode) header->setResizeMode(column, mode);
#endif
// Renamed QHeaderView::setMovable to QHeaderView::setSectionsMovable
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
#define QHeaderView_setSectionsMovable(header, movable) header->setSectionsMovable(movable);
#else
#define QHeaderView_setSectionsMovable(header, movable) header->setMovable(movable);
#endif
#endif