1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
/*
* factory.h
*
* (c) 2008-2011 by Jeremy Bowman <jmbowman@alum.mit.edu>
*
* 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.
*/
/** @file factory.h
* Header file for Factory
*/
#ifndef FACTORY_H
#define FACTORY_H
#include <QIcon>
#include <QLayout>
#include <QStringList>
class QAbstractButton;
class QAbstractItemView;
class QListWidget;
class QSettings;
class QTextEdit;
class QTreeWidget;
class QWidget;
/**
* A collection of static factory methods for creating widgets and layouts
* which have relatively complex default configurations.
*/
class Factory
{
public:
static QGridLayout *gridLayout(QWidget *parent, bool useForParent=false);
static QGridLayout *gridLayout(QBoxLayout *parent);
static QHBoxLayout *hBoxLayout(QWidget *parent, bool useForParent=false);
static QHBoxLayout *hBoxLayout(QBoxLayout *parent);
static QVBoxLayout *vBoxLayout(QWidget *parent, bool useForParent=false);
static QVBoxLayout *vBoxLayout(QBoxLayout *parent);
static QListWidget *listWidget(QWidget *parent);
static QTreeWidget *treeWidget(QWidget *parent, const QStringList &headers);
static QAbstractButton *button(QWidget *parent);
static QTextEdit *textDisplay(QWidget *parent);
static void updatePreferences(QSettings *settings);
static void updateRowColors(QAbstractItemView *view);
private:
static void setupLayout(QLayout *layout);
public:
static QColor evenRowColor;
static QColor oddRowColor;
private:
static bool useAlternatingRowColors;
};
#endif
|