Whitespace cleanup: remove trailing whitespace

Remove all trailing whitespace from the following list of files:
*.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README
excluding 3rdparty, test-data and auto generated code.

Note A): the only non 3rdparty c++-files that still
have trailing whitespace after this change are:
* src/corelib/codecs/cp949codetbl_p.h
* src/corelib/codecs/qjpunicode.cpp
* src/corelib/codecs/qbig5codec.cpp
* src/corelib/xml/qxmlstream_p.h
* src/tools/qdoc/qmlparser/qqmljsgrammar.cpp
* src/tools/uic/ui4.cpp
* tests/auto/other/qtokenautomaton/tokenizers/*
* tests/benchmarks/corelib/tools/qstring/data.cpp
* util/lexgen/tokenizer.cpp

Note B): in about 30 files some overlapping 'leading tab' and
'TAB character in non-leading whitespace' issues have been fixed
to make the sanity bot happy. Plus some general ws-fixes here
and there as asked for during review.

Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Axel Waggershauser 2013-03-15 00:42:15 +01:00 committed by The Qt Project
parent 72367a94a7
commit b11317a643
594 changed files with 3518 additions and 3541 deletions

View File

@ -51,7 +51,7 @@ QImage scale(const QString &imageFileName)
} }
Images::Images(QWidget *parent) Images::Images(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
setWindowTitle(tr("Image loading and scaling example")); setWindowTitle(tr("Image loading and scaling example"));
resize(800, 600); resize(800, 600);
@ -143,4 +143,3 @@ void Images::finished()
} }
#endif // QT_NO_CONCURRENT #endif // QT_NO_CONCURRENT

View File

@ -61,7 +61,7 @@ QMAKE_CFLAGS_WARN_ON =
QMAKE_CFLAGS_WARN_OFF = -w QMAKE_CFLAGS_WARN_OFF = -w
QMAKE_CFLAGS_RELEASE = +O1 QMAKE_CFLAGS_RELEASE = +O1
QMAKE_CFLAGS_DEBUG = -g QMAKE_CFLAGS_DEBUG = -g
QMAKE_CFLAGS_SHLIB = +Z QMAKE_CFLAGS_SHLI = +Z
QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_THREAD = -D_POSIX_C_SOURCE=199506L -D_HPUX_SOURCE -D_REENTRANT -mt QMAKE_CFLAGS_THREAD = -D_POSIX_C_SOURCE=199506L -D_HPUX_SOURCE -D_REENTRANT -mt
@ -74,7 +74,7 @@ QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CXXFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_STATIC_LIB QMAKE_CXXFLAGS_STATIC_LB = $$QMAKE_CFLAGS_STATIC_LIB
QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
QMAKE_CXXFLAGS_THREAD = -D_POSIX_C_SOURCE=199506L -D_REENTRANT -mt QMAKE_CXXFLAGS_THREAD = -D_POSIX_C_SOURCE=199506L -D_REENTRANT -mt

View File

@ -56,7 +56,7 @@ QMAKE_LINK_SHLIB = icpc
QMAKE_LFLAGS = -headerpad_max_install_names QMAKE_LFLAGS = -headerpad_max_install_names
QMAKE_LFLAGS_RELEASE = QMAKE_LFLAGS_RELEASE =
QMAKE_LFLAGS_DEBUG = QMAKE_LFLAGS_DEBUG =
QMAKE_LFLAGS_SHLIB = -single_module -dynamiclib QMAKE_LFLAGS_SHLIB = -ingle_module -dynamiclib
QMAKE_LFLAGS_INCREMENTAL = -undefined suppress -flat_namespace QMAKE_LFLAGS_INCREMENTAL = -undefined suppress -flat_namespace
QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
QMAKE_LFLAGS_SONAME = -install_name$${LITERAL_WHITESPACE} QMAKE_LFLAGS_SONAME = -install_name$${LITERAL_WHITESPACE}

View File

@ -89,7 +89,7 @@ WriteIncludes::WriteIncludes(Uic *uic)
// for the "Phonon::Someclass" classes, however. // for the "Phonon::Someclass" classes, however.
const QString namespaceDelimiter = QLatin1String("::"); const QString namespaceDelimiter = QLatin1String("::");
const ClassInfoEntry *classLibEnd = qclass_lib_map + sizeof(qclass_lib_map)/sizeof(ClassInfoEntry); const ClassInfoEntry *classLibEnd = qclass_lib_map + sizeof(qclass_lib_map)/sizeof(ClassInfoEntry);
for(const ClassInfoEntry *it = qclass_lib_map; it < classLibEnd; ++it) { for (const ClassInfoEntry *it = qclass_lib_map; it < classLibEnd; ++it) {
const QString klass = QLatin1String(it->klass); const QString klass = QLatin1String(it->klass);
const QString module = QLatin1String(it->module); const QString module = QLatin1String(it->module);
QLatin1String header = QLatin1String(it->header); QLatin1String header = QLatin1String(it->header);

View File

@ -100,7 +100,6 @@ void tst_QtConcurrentFilter::filter()
QCOMPARE(vector, QVector<int>() << 2 << 4); QCOMPARE(vector, QVector<int>() << 2 << 4);
} }
// function // function
{ {
QList<int> list; QList<int> list;
@ -554,7 +553,6 @@ void tst_QtConcurrentFilter::filteredReduced()
int sum = QtConcurrent::filteredReduced<int>(vector, KeepEvenIntegers(), IntSumReduce()); int sum = QtConcurrent::filteredReduced<int>(vector, KeepEvenIntegers(), IntSumReduce());
QCOMPARE(sum, 6); QCOMPARE(sum, 6);
} }
{ {
int sum = QtConcurrent::filteredReduced<int>(list.begin(), int sum = QtConcurrent::filteredReduced<int>(list.begin(),
list.end(), list.end(),
@ -1411,7 +1409,6 @@ void tst_QtConcurrentFilter::resultAt()
QFuture<int> future = QtConcurrent::filtered(ints, filterfn); QFuture<int> future = QtConcurrent::filtered(ints, filterfn);
future.waitForFinished(); future.waitForFinished();
for (int i = 0; i < future.resultCount(); ++i) { for (int i = 0; i < future.resultCount(); ++i) {
QCOMPARE(future.resultAt(i), ints.at(i * 2 + 1)); QCOMPARE(future.resultAt(i), ints.at(i * 2 + 1));
} }

View File

@ -268,7 +268,6 @@ void tst_QPicture::boundaryValues_data()
QTest::newRow("min x, max y") << INT_MIN << INT_MAX; QTest::newRow("min x, max y") << INT_MIN << INT_MAX;
QTest::newRow("max x, min y") << INT_MAX << INT_MIN; QTest::newRow("max x, min y") << INT_MAX << INT_MIN;
} }
void tst_QPicture::boundaryValues() void tst_QPicture::boundaryValues()
@ -283,8 +282,6 @@ void tst_QPicture::boundaryValues()
painter.drawPoint(QPoint(x, y)); painter.drawPoint(QPoint(x, y));
painter.end(); painter.end();
} }

View File

@ -48,7 +48,7 @@
class tst_QTextScriptEngine : public QObject class tst_QTextScriptEngine : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
tst_QTextScriptEngine(); tst_QTextScriptEngine();

View File

@ -56,7 +56,7 @@
class tst_QSql : public QObject class tst_QSql : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
tst_QSql(); tst_QSql();
@ -105,7 +105,6 @@ void tst_QSql::cleanup()
{ {
} }
// this is a very basic test for drivers that cannot create/delete tables // this is a very basic test for drivers that cannot create/delete tables
// it can be used while developing new drivers, // it can be used while developing new drivers,
// it's original purpose is to test ODBC Text datasources that are basically // it's original purpose is to test ODBC Text datasources that are basically
@ -120,35 +119,34 @@ void tst_QSql::basicDriverTest()
tst_Databases dbs; tst_Databases dbs;
dbs.open(); dbs.open();
foreach( const QString& dbName, dbs.dbNames ) foreach (const QString& dbName, dbs.dbNames) {
{ QSqlDatabase db = QSqlDatabase::database(dbName);
QSqlDatabase db = QSqlDatabase::database( dbName ); QVERIFY_SQL(db, isValid());
QVERIFY_SQL( db, isValid() );
QStringList tables = db.tables(); QStringList tables = db.tables();
QString tableName; QString tableName;
if ( tables.contains( "qtest_basictest.txt" ) ) if (tables.contains("qtest_basictest.txt"))
tableName = "qtest_basictest.txt"; tableName = "qtest_basictest.txt";
else if ( tables.contains( "qtest_basictest" ) ) else if (tables.contains("qtest_basictest"))
tableName = "qtest_basictest"; tableName = "qtest_basictest";
else if ( tables.contains( "QTEST_BASICTEST" ) ) else if (tables.contains("QTEST_BASICTEST"))
tableName = "QTEST_BASICTEST"; tableName = "QTEST_BASICTEST";
else { else {
QVERIFY( 1 ); QVERIFY(1);
continue; continue;
} }
qDebug("Testing: %s", qPrintable(tst_Databases::dbToString( db ))); qDebug("Testing: %s", qPrintable(tst_Databases::dbToString(db)));
QSqlRecord rInf = db.record( tableName ); QSqlRecord rInf = db.record(tableName);
QCOMPARE( rInf.count(), 2 ); QCOMPARE(rInf.count(), 2);
QCOMPARE( rInf.fieldName( 0 ).toLower(), QString( "id" ) ); QCOMPARE(rInf.fieldName(0).toLower(), QString("id"));
QCOMPARE( rInf.fieldName( 1 ).toLower(), QString( "name" ) ); QCOMPARE(rInf.fieldName(1).toLower(), QString("name"));
} }
dbs.close(); dbs.close();
QVERIFY( 1 ); // make sure the test doesn't fail if no database drivers are there QVERIFY(1); // make sure the test doesn't fail if no database drivers are there
} }
// make sure that the static stuff will be deleted // make sure that the static stuff will be deleted
@ -159,17 +157,17 @@ void tst_QSql::open()
int argc = 1; int argc = 1;
const char *argv[] = {"test"}; const char *argv[] = {"test"};
int count = -1; int count = -1;
for ( i = 0; i < 10; ++i ) { for (i = 0; i < 10; ++i) {
QGuiApplication app(argc, const_cast<char **>(argv), false); QGuiApplication app(argc, const_cast<char **>(argv), false);
tst_Databases dbs; tst_Databases dbs;
dbs.open(); dbs.open();
if ( count == -1 ) if (count == -1)
// first iteration: see how many dbs are open // first iteration: see how many dbs are open
count = (int) dbs.dbNames.count(); count = (int) dbs.dbNames.count();
else else
// next iterations: make sure all are opened again // next iterations: make sure all are opened again
QCOMPARE( count, (int)dbs.dbNames.count() ); QCOMPARE(count, (int)dbs.dbNames.count());
dbs.close(); dbs.close();
} }
} }
@ -191,21 +189,21 @@ void tst_QSql::concurrentAccess()
tst_Databases dbs; tst_Databases dbs;
dbs.open(); dbs.open();
foreach ( const QString& dbName, dbs.dbNames ) { foreach (const QString& dbName, dbs.dbNames) {
QSqlDatabase db = QSqlDatabase::database( dbName ); QSqlDatabase db = QSqlDatabase::database(dbName);
QVERIFY( db.isValid() ); QVERIFY(db.isValid());
if (tst_Databases::isMSAccess(db)) if (tst_Databases::isMSAccess(db))
continue; continue;
QSqlDatabase ndb = QSqlDatabase::addDatabase( db.driverName(), "tst_QSql::concurrentAccess" ); QSqlDatabase ndb = QSqlDatabase::addDatabase(db.driverName(), "tst_QSql::concurrentAccess");
ndb.setDatabaseName( db.databaseName() ); ndb.setDatabaseName(db.databaseName());
ndb.setHostName( db.hostName() ); ndb.setHostName(db.hostName());
ndb.setPort( db.port() ); ndb.setPort(db.port());
ndb.setUserName( db.userName() ); ndb.setUserName(db.userName());
ndb.setPassword( db.password() ); ndb.setPassword(db.password());
QVERIFY_SQL( ndb, open() ); QVERIFY_SQL(ndb, open());
QCOMPARE( db.tables(), ndb.tables() ); QCOMPARE(db.tables(), ndb.tables());
} }
// no database servers installed - don't fail // no database servers installed - don't fail
QVERIFY(1); QVERIFY(1);
@ -222,41 +220,41 @@ void tst_QSql::openErrorRecovery()
dbs.addDbs(); dbs.addDbs();
if (dbs.dbNames.isEmpty()) if (dbs.dbNames.isEmpty())
QSKIP("No database drivers installed"); QSKIP("No database drivers installed");
foreach ( const QString& dbName, dbs.dbNames ) { foreach (const QString& dbName, dbs.dbNames) {
QSqlDatabase db = QSqlDatabase::database( dbName, false ); QSqlDatabase db = QSqlDatabase::database(dbName, false);
CHECK_DATABASE( db ); CHECK_DATABASE(db);
QString userName = db.userName(); QString userName = db.userName();
QString password = db.password(); QString password = db.password();
// force an open error // force an open error
if ( db.open( "dummy130977", "doesnt_exist" ) ) { if (db.open("dummy130977", "doesnt_exist")) {
qDebug("Promiscuous database server without access control - test skipped for %s", qDebug("Promiscuous database server without access control - test skipped for %s",
qPrintable(tst_Databases::dbToString( db )) ); qPrintable(tst_Databases::dbToString(db)));
QVERIFY(1); QVERIFY(1);
continue; continue;
} }
QFAIL_SQL( db, isOpen() ); QFAIL_SQL(db, isOpen());
QVERIFY_SQL( db, isOpenError() ); QVERIFY_SQL(db, isOpenError());
// now open it // now open it
if ( !db.open( userName, password ) ) { if (!db.open(userName, password)) {
qDebug() << "Could not open Database " << tst_Databases::dbToString( db ) << qDebug() << "Could not open Database " << tst_Databases::dbToString(db) <<
". Assuming DB is down, skipping... (Error: " << ". Assuming DB is down, skipping... (Error: " <<
tst_Databases::printError( db.lastError() ) << ")"; tst_Databases::printError(db.lastError()) << ")";
continue; continue;
} }
QVERIFY_SQL( db, open( userName, password ) ); QVERIFY_SQL(db, open(userName, password));
QVERIFY_SQL( db, isOpen() ); QVERIFY_SQL(db, isOpen());
QFAIL_SQL( db, isOpenError() ); QFAIL_SQL(db, isOpenError());
db.close(); db.close();
QFAIL_SQL( db, isOpen() ); QFAIL_SQL(db, isOpen());
// force another open error // force another open error
QFAIL_SQL( db, open( "dummy130977", "doesnt_exist" ) ); QFAIL_SQL(db, open("dummy130977", "doesnt_exist"));
QFAIL_SQL( db, isOpen() ); QFAIL_SQL(db, isOpen());
QVERIFY_SQL( db, isOpenError() ); QVERIFY_SQL(db, isOpenError());
} }
} }
@ -266,13 +264,13 @@ void tst_QSql::registerSqlDriver()
const char *argv[] = {"test"}; const char *argv[] = {"test"};
QGuiApplication app(argc, const_cast<char **>(argv), false); QGuiApplication app(argc, const_cast<char **>(argv), false);
QSqlDatabase::registerSqlDriver( "QSQLTESTDRIVER", new QSqlDriverCreator<QSqlNullDriver> ); QSqlDatabase::registerSqlDriver("QSQLTESTDRIVER", new QSqlDriverCreator<QSqlNullDriver>);
QVERIFY( QSqlDatabase::drivers().contains( "QSQLTESTDRIVER" ) ); QVERIFY(QSqlDatabase::drivers().contains("QSQLTESTDRIVER"));
QSqlDatabase db = QSqlDatabase::addDatabase( "QSQLTESTDRIVER" ); QSqlDatabase db = QSqlDatabase::addDatabase("QSQLTESTDRIVER");
QVERIFY( db.isValid() ); QVERIFY(db.isValid());
QCOMPARE( db.tables(), QStringList() ); QCOMPARE(db.tables(), QStringList());
} }
QTEST_APPLESS_MAIN(tst_QSql) QTEST_APPLESS_MAIN(tst_QSql)

View File

@ -43,17 +43,21 @@
#include <QObject> #include <QObject>
class GadgetWithNoEnums { class GadgetWithNoEnums
{
Q_GADGET Q_GADGET
public:
public:
GadgetWithNoEnums() {} GadgetWithNoEnums() {}
virtual ~GadgetWithNoEnums() {} virtual ~GadgetWithNoEnums() {}
}; };
class DerivedGadgetWithEnums : public GadgetWithNoEnums { class DerivedGadgetWithEnums : public GadgetWithNoEnums
{
Q_GADGET Q_GADGET
Q_ENUMS( FooEnum ) Q_ENUMS( FooEnum )
public:
public:
enum FooEnum { FooValue }; enum FooEnum { FooValue };
DerivedGadgetWithEnums() {} DerivedGadgetWithEnums() {}
~DerivedGadgetWithEnums() {} ~DerivedGadgetWithEnums() {}

View File

@ -45,8 +45,10 @@
#include <QObject> #include <QObject>
class InlineSlotsWithThrowDeclaration : public QObject { class InlineSlotsWithThrowDeclaration : public QObject
{
Q_OBJECT Q_OBJECT
public slots: public slots:
void a() throw() { } void a() throw() { }
void b() const throw() { } void b() const throw() { }

View File

@ -40,6 +40,7 @@
****************************************************************************/ ****************************************************************************/
#include <QApplication> #include <QApplication>
#include <stdio.h> #include <stdio.h>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);

View File

@ -64,7 +64,7 @@ AbstractItemView::~AbstractItemView()
/*virtual*/ /*virtual*/
void AbstractItemView::setModel(QAbstractItemModel *model, AbstractViewItem *prototype) void AbstractItemView::setModel(QAbstractItemModel *model, AbstractViewItem *prototype)
{ {
if( m_model == model || !model) if (m_model == model || !model)
return; return;
if (m_model) { if (m_model) {
@ -260,7 +260,6 @@ void AbstractItemView::rowsAboutToBeInserted(const QModelIndex &index, int start
// TODO implement // TODO implement
} }
/*virtual*/ /*virtual*/
void AbstractItemView::rowsAboutToBeRemoved(const QModelIndex &index,int start, int end) void AbstractItemView::rowsAboutToBeRemoved(const QModelIndex &index,int start, int end)
{ {
@ -346,7 +345,7 @@ bool AbstractItemView::event(QEvent *e)
m_container->resize(this->size().width()-verticalScrollBar()->size().width(), m_container->resize(this->size().width()-verticalScrollBar()->size().width(),
m_container->preferredHeight()); m_container->preferredHeight());
if(verticalScrollBar()->sliderPosition() > verticalScrollBar()->sliderSize()) if (verticalScrollBar()->sliderPosition() > verticalScrollBar()->sliderSize())
verticalScrollBar()->setSliderPosition(verticalScrollBar()->sliderSize()); verticalScrollBar()->setSliderPosition(verticalScrollBar()->sliderSize());
result = true; result = true;
@ -394,10 +393,9 @@ void AbstractItemView::scrollContentsBy(qreal dx, qreal dy)
qreal itemH = 1; qreal itemH = 1;
AbstractViewItem *item = m_container->itemAt(0); AbstractViewItem *item = m_container->itemAt(0);
if(item && item->size().height() > 1) { if (item && item->size().height() > 1) {
itemH = item->size().height(); itemH = item->size().height();
} } else if (item && item->preferredHeight() > 1) {
else if(item && item->preferredHeight() > 1) {
itemH = item->preferredHeight(); itemH = item->preferredHeight();
} }
@ -407,8 +405,7 @@ void AbstractItemView::scrollContentsBy(qreal dx, qreal dy)
if ((vpy+m_container->size().height()-dy > pos().y()+size().height()) && if ((vpy+m_container->size().height()-dy > pos().y()+size().height()) &&
(qAbs(dy) < itemH) && (vpy-dy <= 0)) { (qAbs(dy) < itemH) && (vpy-dy <= 0)) {
m_container->setPos(vpx, vpy-dy); m_container->setPos(vpx, vpy-dy);
} } else {
else {
qreal vPos = verticalScrollBar()->sliderPosition(); qreal vPos = verticalScrollBar()->sliderPosition();
int startRow = m_model->index(vPos/itemH, 0).row(); int startRow = m_model->index(vPos/itemH, 0).row();
int itemsInContainer = m_container->itemCount(); int itemsInContainer = m_container->itemCount();

View File

@ -59,7 +59,6 @@ BackgroundItem::BackgroundItem(const QString &filename, QGraphicsWidget *parent)
BackgroundItem::~BackgroundItem() BackgroundItem::~BackgroundItem()
{ {
} }
void BackgroundItem::resizeEvent(QGraphicsSceneResizeEvent *event) void BackgroundItem::resizeEvent(QGraphicsSceneResizeEvent *event)

View File

@ -74,7 +74,6 @@ DummyDataGenerator::DummyDataGenerator() : m_isMale(false)
DummyDataGenerator::~DummyDataGenerator() DummyDataGenerator::~DummyDataGenerator()
{ {
} }
void DummyDataGenerator::Reset() void DummyDataGenerator::Reset()
@ -117,10 +116,10 @@ QString DummyDataGenerator::randomIconItem()
if (qrand()%4) { if (qrand()%4) {
int randVal = 1+qrand()%25; int randVal = 1+qrand()%25;
if(m_isMale && randVal > 15) { if (m_isMale && randVal > 15) {
randVal -= 15; randVal -= 15;
} }
if(!m_isMale && randVal <= 10) { if (!m_isMale && randVal <= 10) {
randVal += 10; randVal += 10;
} }
@ -131,8 +130,7 @@ QString DummyDataGenerator::randomIconItem()
QString DummyDataGenerator::randomStatusItem() QString DummyDataGenerator::randomStatusItem()
{ {
switch ( qrand()%3 ) switch (qrand()%3) {
{
case 0: return Theme::p()->pixmapPath() + "contact_status_online.svg"; case 0: return Theme::p()->pixmapPath() + "contact_status_online.svg";
case 1: return Theme::p()->pixmapPath() + "contact_status_offline.svg"; case 1: return Theme::p()->pixmapPath() + "contact_status_offline.svg";
case 2: return Theme::p()->pixmapPath() + "contact_status_idle.svg"; case 2: return Theme::p()->pixmapPath() + "contact_status_idle.svg";

View File

@ -43,7 +43,7 @@
#include "label.h" #include "label.h"
Label::Label(const QString& text, QGraphicsItem *parent) Label::Label(const QString &text, QGraphicsItem *parent)
: GvbWidget(parent) : GvbWidget(parent)
{ {
m_textItem = new QGraphicsSimpleTextItem(this); m_textItem = new QGraphicsSimpleTextItem(this);
@ -58,7 +58,7 @@ Label::~Label()
{ {
} }
void Label::setText(const QString& text) void Label::setText(const QString &text)
{ {
m_textItem->setText(text); m_textItem->setText(text);
prepareGeometryChange(); prepareGeometryChange();
@ -81,12 +81,10 @@ void Label::resizeEvent(QGraphicsSceneResizeEvent *event)
QSizeF Label::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const QSizeF Label::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
{ {
switch (which) switch (which) {
{
case Qt::MinimumSize: case Qt::MinimumSize:
// fall thru // fall thru
case Qt::PreferredSize: case Qt::PreferredSize: {
{
QFontMetricsF fm(m_textItem->font()); QFontMetricsF fm(m_textItem->font());
return QSizeF(fm.width(m_textItem->text()), fm.height()); return QSizeF(fm.width(m_textItem->text()), fm.height());
} }

View File

@ -64,16 +64,16 @@ struct ItemData
Q_DECLARE_METATYPE(ItemData); Q_DECLARE_METATYPE(ItemData);
ListItem::ListItem(QGraphicsWidget *parent) ListItem::ListItem(QGraphicsWidget *parent)
: GvbWidget(parent), : GvbWidget(parent)
m_txtlayout(new QGraphicsGridLayout()), , m_txtlayout(new QGraphicsGridLayout())
m_layout(new QGraphicsLinearLayout(Qt::Horizontal)), , m_layout(new QGraphicsLinearLayout(Qt::Horizontal))
m_liconlayout(new QGraphicsLinearLayout(Qt::Horizontal)), , m_liconlayout(new QGraphicsLinearLayout(Qt::Horizontal))
m_riconlayout(new QGraphicsLinearLayout(Qt::Horizontal)) , m_riconlayout(new QGraphicsLinearLayout(Qt::Horizontal))
,m_fonts() , m_fonts()
,m_borderPen(Qt::NoPen) , m_borderPen(Qt::NoPen)
,m_backgroundBrush(QBrush()) , m_backgroundBrush(QBrush())
,m_backgroundOpacity(1.0) , m_backgroundOpacity(1.0)
,m_rounding(0.0, 0.0) , m_rounding(0.0, 0.0)
{ {
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
setContentsMargins(0,4,4,0); setContentsMargins(0,4,4,0);
@ -97,39 +97,36 @@ ListItem::ListItem(QGraphicsWidget *parent)
ListItem::~ListItem() ListItem::~ListItem()
{ {
if ( !m_liconlayout->parentLayoutItem() ) if (!m_liconlayout->parentLayoutItem())
delete m_liconlayout; delete m_liconlayout;
if ( !m_riconlayout->parentLayoutItem() ) if (!m_riconlayout->parentLayoutItem())
delete m_riconlayout; delete m_riconlayout;
} }
void ListItem::setIcon( IconItem *iconItem, const IconItemPos iconPos ) void ListItem::setIcon(IconItem *iconItem, const IconItemPos iconPos)
{ {
if (iconPos == LeftIcon) { if (iconPos == LeftIcon) {
if (m_liconlayout->count() > 0 && m_liconlayout->itemAt(0)) { if (m_liconlayout->count() > 0 && m_liconlayout->itemAt(0)) {
delete m_liconlayout->itemAt(0); delete m_liconlayout->itemAt(0);
m_liconlayout->addItem( iconItem ); m_liconlayout->addItem(iconItem);
} else {
m_liconlayout->addItem(iconItem);
} }
else { m_liconlayout->itemAt(0)->setMaximumSize(58, 58);
m_liconlayout->addItem( iconItem ); } else if (iconPos == RightIcon) {
}
m_liconlayout->itemAt(0)->setMaximumSize(58,58);
}
else if (iconPos == RightIcon) {
if (m_riconlayout->count() > 0 && m_riconlayout->itemAt(0)) { if (m_riconlayout->count() > 0 && m_riconlayout->itemAt(0)) {
delete m_riconlayout->itemAt(0); delete m_riconlayout->itemAt(0);
m_riconlayout->addItem( iconItem ); m_riconlayout->addItem(iconItem);
} else {
m_riconlayout->addItem(iconItem);
} }
else { m_riconlayout->itemAt(0)->setMaximumSize(22, 22);
m_riconlayout->addItem( iconItem );
}
m_riconlayout->itemAt(0)->setMaximumSize(22,22);
} }
m_layout->invalidate(); m_layout->invalidate();
} }
IconItem* ListItem::icon( const IconItemPos iconPos ) const IconItem* ListItem::icon(const IconItemPos iconPos) const
{ {
QGraphicsLayoutItem* item = 0; QGraphicsLayoutItem* item = 0;
@ -203,13 +200,13 @@ void ListItem::setData(const QVariant &value, int role)
ItemData data = value.value<ItemData>(); ItemData data = value.value<ItemData>();
QList<ListItem::TextPos> textkeys = data.texts.keys(); QList<ListItem::TextPos> textkeys = data.texts.keys();
for( int i = 0; i<textkeys.count(); ++i) { for (int i = 0; i<textkeys.count(); ++i) {
setText(data.texts[textkeys.at(i)],textkeys.at(i)); setText(data.texts[textkeys.at(i)], textkeys.at(i));
setFont(data.fonts[textkeys.at(i)], textkeys.at(i)); setFont(data.fonts[textkeys.at(i)], textkeys.at(i));
} }
QList<ListItem::IconItemPos> iconkeys = data.icons.keys(); QList<ListItem::IconItemPos> iconkeys = data.icons.keys();
for( int i = 0; i<iconkeys.count(); ++i) { for (int i = 0; i<iconkeys.count(); ++i) {
IconItem *iconItem = icon(iconkeys.at(i)); IconItem *iconItem = icon(iconkeys.at(i));
if (iconItem) if (iconItem)
iconItem->setFileName(data.icons[iconkeys.at(i)]); iconItem->setFileName(data.icons[iconkeys.at(i)]);
@ -249,8 +246,7 @@ void ListItem::setText(const QString str, const TextPos position)
m_txtlayout->addItem(label, position, 0); m_txtlayout->addItem(label, position, 0);
if (m_fonts.contains(position)) if (m_fonts.contains(position))
label->setFont(m_fonts[position]); label->setFont(m_fonts[position]);
} } else {
else {
Label *titem = static_cast<Label *>(item); Label *titem = static_cast<Label *>(item);
titem->setText(str); titem->setText(str);
} }
@ -290,14 +286,12 @@ void ListItem::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option
QRectF r = rect(); QRectF r = rect();
r.adjust(penWidth, penWidth, -penWidth, -penWidth); r.adjust(penWidth, penWidth, -penWidth, -penWidth);
if (m_borderPen != Qt::NoPen) if (m_borderPen != Qt::NoPen) {
{
painter->setPen(m_borderPen); painter->setPen(m_borderPen);
painter->drawRoundedRect(r, m_rounding.width(), m_rounding.height()); painter->drawRoundedRect(r, m_rounding.width(), m_rounding.height());
} }
if (m_backgroundBrush != Qt::NoBrush) if (m_backgroundBrush != Qt::NoBrush) {
{
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
painter->setBrush(m_backgroundBrush); painter->setBrush(m_backgroundBrush);
painter->setOpacity(m_backgroundOpacity); painter->setOpacity(m_backgroundOpacity);

View File

@ -215,7 +215,7 @@ QRectF TopBar::boundingRect() const
QHash<QString, QSize>sizes = (Theme::p()->theme() == Theme::Blue) ? QHash<QString, QSize>sizes = (Theme::p()->theme() == Theme::Blue) ?
m_sizesBlue : m_sizesLime; m_sizesBlue : m_sizesLime;
if(!m_topBarPixmap.isNull()) if (!m_topBarPixmap.isNull())
return QRectF(0, 0, m_topBarPixmap.size().width(), m_topBarPixmap.size().height()); return QRectF(0, 0, m_topBarPixmap.size().width(), m_topBarPixmap.size().height());
else else
return QRectF(0, 0, sizes["topbar.svg"].width(), sizes["topbar.svg"].height()); return QRectF(0, 0, sizes["topbar.svg"].width(), sizes["topbar.svg"].height());

View File

@ -72,8 +72,10 @@ public:
void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 ); void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
QRectF boundingRect() const; QRectF boundingRect() const;
void resizeEvent(QGraphicsSceneResizeEvent *event); void resizeEvent(QGraphicsSceneResizeEvent *event);
inline QPoint getStatusBarLocation() { return m_topBarStatusBarMiddlePoint + inline QPoint getStatusBarLocation()
m_topBarStatusBarMiddle.rect().bottomLeft(); } {
return m_topBarStatusBarMiddlePoint + m_topBarStatusBarMiddle.rect().bottomLeft();
}
public slots: public slots:
void themeChange(); void themeChange();
@ -89,7 +91,6 @@ private:
const QSizeF &constraint = QSizeF()) const; const QSizeF &constraint = QSizeF()) const;
void setDefaultSizes(); void setDefaultSizes();
private: private:
Q_DISABLE_COPY(TopBar) Q_DISABLE_COPY(TopBar)

View File

@ -86,7 +86,6 @@ void WebViewPrivate::adjustSize()
else else
q->horizontalScrollBar()->setSliderSize(0.0); q->horizontalScrollBar()->setSliderSize(0.0);
if (h > q->viewport()->boundingRect().height()) if (h > q->viewport()->boundingRect().height())
q->verticalScrollBar()->setSliderSize(h); q->verticalScrollBar()->setSliderSize(h);
else else
@ -131,7 +130,6 @@ void WebViewPrivate::_q_motionEnded()
WebViewCache::WebViewCache(QGraphicsWebView *webView) WebViewCache::WebViewCache(QGraphicsWebView *webView)
: m_webView(webView) : m_webView(webView)
{ {
} }
WebViewCache::~WebViewCache() WebViewCache::~WebViewCache()

View File

@ -42,7 +42,6 @@
#include <QtWidgets> #include <QtWidgets>
#include "../shared/shared.h" #include "../shared/shared.h"
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
@ -58,7 +57,6 @@ int main(int argc, char **argv)
scrollView.resize(600, 400); scrollView.resize(600, 400);
scrollView.show(); scrollView.show();
return app.exec(); return app.exec();
} }

View File

@ -45,7 +45,7 @@
class CellWidget : public QWidget class CellWidget : public QWidget
{ {
public: public:
CellWidget (QWidget *parent = 0) : QWidget(parent) { } CellWidget(QWidget *parent = 0) : QWidget(parent) {}
void paintEvent(QPaintEvent * event) void paintEvent(QPaintEvent * event)
{ {
static int value = 200; static int value = 200;
@ -70,7 +70,6 @@ int main(int argc, char **argv)
tableWidget.resize(400, 600); tableWidget.resize(400, 600);
tableWidget.show(); tableWidget.show();
return app.exec(); return app.exec();
} }

View File

@ -45,11 +45,12 @@
class MyWidget : public QWidget class MyWidget : public QWidget
{ {
public: public:
MyWidget() : QWidget() { MyWidget() : QWidget()
{
setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_OpaquePaintEvent);
setAttribute(Qt::WA_StaticContents); } setAttribute(Qt::WA_StaticContents);
}
protected: protected:
void paintEvent(QPaintEvent *e) { qDebug() << e->rect(); } void paintEvent(QPaintEvent *e) { qDebug() << e->rect(); }
}; };

View File

@ -288,7 +288,6 @@ DFA NFA::toDFA() const
if (transition.key() == Epsilon && epsilonStates.contains(transition.value())) if (transition.key() == Epsilon && epsilonStates.contains(transition.value()))
epsilonStates.insert(i, epsilonStates.value(transition.value())); epsilonStates.insert(i, epsilonStates.value(transition.value()));
} }
} while (lastCount != epsilonStates.count()); } while (lastCount != epsilonStates.count());
for (int i = 0; i < states.count(); ++i) { for (int i = 0; i < states.count(); ++i) {
@ -313,7 +312,6 @@ DFA NFA::toDFA() const
*/ */
} }
QSet<InputType> validInput; QSet<InputType> validInput;
foreach (const State &s, states) foreach (const State &s, states)
for (TransitionMap::ConstIterator it = s.transitions.constBegin(), for (TransitionMap::ConstIterator it = s.transitions.constBegin(),
@ -504,5 +502,3 @@ DFA DFA::minimize() const
return *this; return *this;
} }