Example #1
0
void ReceiveCoinsDialog::setModel(WalletModel *_model)
{
    this->model = _model;

    if(_model && _model->getOptionsModel())
    {
        _model->getRecentRequestsTableModel()->sort(RecentRequestsTableModel::Date, Qt::DescendingOrder);
        connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
        updateDisplayUnit();

        QTableView* tableView = ui->recentRequestsView;

        tableView->verticalHeader()->hide();
        tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        tableView->setModel(_model->getRecentRequestsTableModel());
        tableView->setAlternatingRowColors(true);
        tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
        tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
        tableView->setColumnWidth(RecentRequestsTableModel::Date, DATE_COLUMN_WIDTH);
        tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH);
        tableView->setColumnWidth(RecentRequestsTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);

        connect(tableView->selectionModel(),
            SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
            SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
        // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
        columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
    }
Example #2
0
void MainWindow::loadNetwork() 
{
    setWindowTitle("Qt-dtnet - " + ws.networkFilename);

    delete networkToolBox;
    networkToolBox = new QToolBox();
    ui->dockProperties->setWidget(networkToolBox);

    QTableView *propertiesTree;

    std::map<std::string,Population>::iterator i;
    for (i = ws.net->populations.begin(); i != ws.net->populations.end(); ++i)
    {
        propertiesTree = new QTableView();
        propertiesTree->setAlternatingRowColors(false);
        propertiesTree->setSelectionBehavior( QAbstractItemView::SelectRows );
        propertiesTree->setWordWrap( false );
//        propertiesTree->setAnimated( false );
        networkToolBox->addItem(propertiesTree, QString::fromStdString(i->first));
        propertiesModel = new PropModel( &(i->second) );    
        propertiesTree->setModel(propertiesModel);
    }
	
	networkView->replaceNetwork( ws.net );
	networkView->show();
    
    if ( ws.trial->isReady() && ws.net->isReady() ) ui->actionRun_Simulation->setEnabled( true );   
}
void availableRoomsWindow::initializeTable()
{
    qDebug() << Q_FUNC_INFO;

    QTableView* tableView = ui->tableView;
    tableView->setModel(parameters->availableRoomsMdl);

    tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
    tableView->setAlternatingRowColors(true);
    tableView->setSelectionMode(QAbstractItemView::SingleSelection);

    tableView->horizontalHeader()->setHighlightSections(false);
    tableView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
    tableView->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
    tableView->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
    tableView->horizontalHeader()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
    tableView->horizontalHeader()->setSectionResizeMode(5, QHeaderView::ResizeToContents);

    tableView->hideColumn(1);
    tableView->hideColumn(6);
    tableView->hideColumn(7);
    tableView->hideColumn(8);
    tableView->hideColumn(9);
    tableView->hideColumn(10);
    tableView->hideColumn(11);
    tableView->hideColumn(12);
    tableView->hideColumn(13);

    tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
    ui->tableView->verticalHeader()->setDefaultSectionSize(23);
}
ErrorListView::ErrorListView(QWidget* parent)
  : QWidget(parent),
    m_model(0)
{
    m_model = new ErrorListModel(this);
    
    QTableView* tableView = new QTableView;
    
    tableView->setItemDelegate(new ItemDelegate);
    tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
    tableView->setAlternatingRowColors(true);
    tableView->setShowGrid(false);
    tableView->verticalHeader()->hide();
    
    tableView->setModel(m_model);
    
#ifdef STROMX_STUDIO_QT4
    tableView->horizontalHeader()->setResizeMode(ErrorListModel::TIME, QHeaderView::Interactive);
    tableView->horizontalHeader()->setResizeMode(ErrorListModel::DESCRIPTION, QHeaderView::Stretch);
#else
    tableView->horizontalHeader()->setSectionResizeMode(ErrorListModel::TIME, QHeaderView::Interactive);
    tableView->horizontalHeader()->setSectionResizeMode(ErrorListModel::DESCRIPTION, QHeaderView::Stretch);
#endif // STROMX_STUDIO_QT4
    
    QPushButton* clearButton = new QPushButton(tr("Clear error log"));
    connect(clearButton, SIGNAL(clicked()), m_model, SLOT(clear()));
    QHBoxLayout* buttonLayout = new QHBoxLayout;
    buttonLayout->addWidget(clearButton);
    buttonLayout->addStretch();
    
    QVBoxLayout* mainLayout = new QVBoxLayout;
    mainLayout->addWidget(tableView);
    mainLayout->addLayout(buttonLayout);
    setLayout(mainLayout);
}
Example #5
0
    // Table factory
    QTableView* MakeTableView(QAbstractItemModel* model, bool sortingEnabled = true, uint32_t modelSortColumn = 0)
    {
        class MyTable : public QTableView
        {
        public:
            QStyleOptionViewItem viewOptions() const override
            {
                QStyleOptionViewItem option = QTableView::viewOptions();
                option.decorationAlignment = Qt::AlignHCenter | Qt::AlignCenter;
                option.decorationPosition = QStyleOptionViewItem::Top;
                return option;
            }

            void mouseMoveEvent(QMouseEvent* event) override
            {
                QModelIndex index = indexAt(event->pos());
                if (index.isValid()) {
                    QVariant data = model()->data(index, PlayerTableModel::CursorRole);
                    Qt::CursorShape shape = Qt::ArrowCursor;
                    if (!data.isNull()) {
                        shape = Qt::CursorShape(data.toInt());
                    }
                    setCursor(shape);
                }

                QTableView::mouseMoveEvent(event);
            }
        };

        QTableView* tableView = new MyTable();
        tableView->setModel(model);
        tableView->setSortingEnabled(sortingEnabled);
        if (sortingEnabled) {
            tableView->sortByColumn(FindColumn(model, modelSortColumn));
        }
        tableView->verticalHeader()->hide();
        tableView->setAlternatingRowColors(true);
        tableView->verticalHeader()->setDefaultSectionSize(15);
        tableView->resizeColumnsToContents();
        tableView->horizontalHeader()->setStretchLastSection(true);
        tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
        tableView->setSelectionMode(QAbstractItemView::SingleSelection);
        tableView->setFocusPolicy(Qt::StrongFocus);

        // enable mouse tracking
        tableView->setMouseTracking(true);
        tableView->viewport()->setMouseTracking(true);
        tableView->installEventFilter(this);
        tableView->viewport()->installEventFilter(this);

        return tableView;
    }
Example #6
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QMap<QString, double> currencyMap;
    currencyMap.insert("AUD", 1.3257);
    currencyMap.insert("CHF", 1.2980);
    currencyMap.insert("SGD", 1.6911);
    currencyMap.insert("USD", 1.0000);

    CurrencyModel currencyModel(currencyMap);

    QTableView tableView;
    tableView.setModel(&currencyModel);
    tableView.setAlternatingRowColors(true);
    tableView.show();

    return a.exec();
}
Example #7
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    //QListView view;
    QTableView view;
    view.setSortingEnabled(false);
    view.horizontalHeader()->setStretchLastSection(true);
    view.horizontalHeader()->setVisible(false);
    view.verticalHeader()->setVisible(false);

    MillionRows model(Q_NULLPTR);

    view.setModel(&model);
    view.setAlternatingRowColors(true);
    view.setStyleSheet("alternate-background-color: green;background-color: white;");
    view.setItemDelegateForColumn(0, new TableStyleDelegate());

    view.resizeRowsToContents(); // impact performance - force call sizeHint
    view.show();

    return a.exec();
}
void ReceiveCoinsDialog::setModel(WalletModel *_model)
{
    this->model = _model;

    if(_model && _model->getOptionsModel())
    {
        _model->getRecentRequestsTableModel()->sort(RecentRequestsTableModel::Date, Qt::DescendingOrder);
        connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
        updateDisplayUnit();

        QTableView* tableView = ui->recentRequestsView;

        tableView->verticalHeader()->hide();
        tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        tableView->setModel(_model->getRecentRequestsTableModel());
        tableView->setAlternatingRowColors(true);
        tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
        tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
        tableView->setColumnWidth(RecentRequestsTableModel::Date, DATE_COLUMN_WIDTH);
        tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH);
        tableView->setColumnWidth(RecentRequestsTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);

        connect(tableView->selectionModel(),
            SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
            SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
        // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
        columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);

        if (model->wallet().getDefaultAddressType() == OutputType::BECH32) {
            ui->useBech32->setCheckState(Qt::Checked);
        } else {
            ui->useBech32->setCheckState(Qt::Unchecked);
        }

        // eventually disable the main receive button if private key operations are disabled
        ui->receiveButton->setEnabled(!model->privateKeysDisabled());
    }
Example #9
0
MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags f) :
	QMainWindow(parent, f),
	configurationModels(),
	geometryModels(),
	ikAlgorithmComboBox(new QComboBox(this)),
	ikDurationSpinBox(new QSpinBox(this)),
	ikIterationsSpinBox(new QSpinBox(this)),
	ikJacobianComboBox(new QComboBox(this)),
	kinematicModels(),
	operationalModels(),
	scene(),
	configurationDelegates(),
	configurationDockWidget(new QDockWidget(this)),
	configurationTabWidget(new QTabWidget(this)),
	configurationViews(),
	gradientBackground(),
	operationalDelegates(),
	operationalDockWidget(new QDockWidget(this)),
	operationalTabWidget(new QTabWidget(this)),
	operationalViews(),
	saveImageWithAlphaAction(new QAction(this)),
	saveImageWithoutAlphaAction(new QAction(this)),
	saveSceneAction(new QAction(this)),
	server(new Server(this)),
	viewer(nullptr)
{
	MainWindow::singleton = this;
	
	SoQt::init(this);
	SoDB::init();
	SoGradientBackground::initClass();
	
	std::shared_ptr<rl::sg::Factory> geometryFactory;
	std::string geometryFilename = QApplication::arguments()[1].toStdString();
	
	if ("urdf" == geometryFilename.substr(geometryFilename.length() - 4, 4))
	{
		geometryFactory = std::make_shared<rl::sg::UrdfFactory>();
	}
	else
	{
		geometryFactory = std::make_shared<rl::sg::XmlFactory>();
	}
	
	this->scene = std::make_shared<rl::sg::so::Scene>();
	geometryFactory->load(geometryFilename, this->scene.get());
	
	for (int i = 2; i < QApplication::arguments().size(); ++i)
	{
		std::shared_ptr<rl::mdl::Factory> kinematicFactory;
		std::string kinematicFilename = QApplication::arguments()[i].toStdString();
		
		if ("urdf" == kinematicFilename.substr(kinematicFilename.length() - 4, 4))
		{
			kinematicFactory = std::make_shared<rl::mdl::UrdfFactory>();
		}
		else
		{
			kinematicFactory = std::make_shared<rl::mdl::XmlFactory>();
		}
		
		this->geometryModels.push_back(this->scene->getModel(i - 2));
		this->kinematicModels.push_back(std::dynamic_pointer_cast<rl::mdl::Kinematic>(kinematicFactory->create(kinematicFilename)));
	}
	
	for (std::size_t i = 0; i < this->kinematicModels.size(); ++i)
	{
		ConfigurationDelegate* configurationDelegate = new ConfigurationDelegate(this);
		configurationDelegate->id = i;
		this->configurationDelegates.push_back(configurationDelegate);
		
		ConfigurationModel* configurationModel = new ConfigurationModel(this);
		configurationModel->id = i;
		this->configurationModels.push_back(configurationModel);
		
		QTableView* configurationView = new QTableView(this);
#if QT_VERSION >= 0x050000
		configurationView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
#else // QT_VERSION
		configurationView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
#endif // QT_VERSION
		configurationView->horizontalHeader()->hide();
		configurationView->setAlternatingRowColors(true);
		configurationView->setItemDelegate(configurationDelegate);
		configurationView->setModel(configurationModel);
		this->configurationViews.push_back(configurationView);
		
		this->configurationTabWidget->addTab(configurationView, QString::number(i));
		
		OperationalDelegate* operationalDelegate = new OperationalDelegate(this);
		this->operationalDelegates.push_back(operationalDelegate);
		
		OperationalModel* operationalModel = new OperationalModel(this);
		operationalModel->id = i;
		this->operationalModels.push_back(operationalModel);
		
		QTableView* operationalView = new QTableView(this);
#if QT_VERSION >= 0x050000
		operationalView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
#else // QT_VERSION
		operationalView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
#endif // QT_VERSION
		operationalView->setAlternatingRowColors(true);
		operationalView->setItemDelegate(operationalDelegate);
		operationalView->setModel(operationalModel);
		this->operationalViews.push_back(operationalView);
		
		this->operationalTabWidget->addTab(operationalView, QString::number(i));
		
		QObject::connect(
			configurationModel,
			SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
			operationalModel,
			SLOT(configurationChanged(const QModelIndex&, const QModelIndex&))
		);
		
		QObject::connect(
			operationalModel,
			SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
			configurationModel,
			SLOT(operationalChanged(const QModelIndex&, const QModelIndex&))
		);
		
		configurationModel->setData(this->kinematicModels[i]->getHomePosition());
	}
	
	this->configurationDockWidget->resize(160, 320);
	this->configurationDockWidget->setWidget(this->configurationTabWidget);
	this->configurationDockWidget->setWindowTitle("Configuration");
	
	this->operationalDockWidget->resize(160, 320);
	this->operationalDockWidget->setWidget(this->operationalTabWidget);
	this->operationalDockWidget->setWindowTitle("Operational");
	
	this->addDockWidget(Qt::LeftDockWidgetArea, this->configurationDockWidget);
	this->addDockWidget(Qt::BottomDockWidgetArea, this->operationalDockWidget);
	
#if QT_VERSION >= 0x050600
	QList<QDockWidget*> resizeDocksWidgets;
	resizeDocksWidgets.append(this->operationalDockWidget);
	QList<int> resizeDocksSizes;
	resizeDocksSizes.append(1);
	this->resizeDocks(resizeDocksWidgets, resizeDocksSizes, Qt::Vertical);
#endif // QT_VERSION
	
	this->ikAlgorithmComboBox->addItem("JacobianInverseKinematics");
#ifdef RL_MDL_NLOPT
	this->ikAlgorithmComboBox->addItem("NloptInverseKinematics");
#endif
	this->ikAlgorithmComboBox->setToolTip("IK Algorithm");
	
#ifdef RL_MDL_NLOPT
	this->ikAlgorithmComboBox->setCurrentIndex(this->ikAlgorithmComboBox->findText("NloptInverseKinematics"));
#endif
	
	QObject::connect(this->ikAlgorithmComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeIkAlgorithm()));
	
	this->ikDurationSpinBox->setMaximum(10000);
	this->ikDurationSpinBox->setMinimum(1);
	this->ikDurationSpinBox->setSuffix(" ms");
	this->ikDurationSpinBox->setToolTip("Max. IK Duration");
	this->ikDurationSpinBox->setValue(500);
	
	this->ikIterationsSpinBox->setMaximum(100000);
	this->ikIterationsSpinBox->setMinimum(1);
	this->ikIterationsSpinBox->setToolTip("Max. IK Iterations");
	this->ikIterationsSpinBox->setValue(10000);
	
	this->ikJacobianComboBox->addItem("DLS");
	this->ikJacobianComboBox->addItem("SVD");
	this->ikJacobianComboBox->addItem("Transpose");
	this->ikJacobianComboBox->setToolTip("Jacobian Method");
	this->ikJacobianComboBox->setCurrentIndex(this->ikJacobianComboBox->findText("SVD"));
	
	this->statusBar()->addPermanentWidget(this->ikAlgorithmComboBox);
	this->statusBar()->addPermanentWidget(this->ikJacobianComboBox);
	this->statusBar()->addPermanentWidget(this->ikIterationsSpinBox);
	this->statusBar()->addPermanentWidget(this->ikDurationSpinBox);
	
	this->changeIkAlgorithm();
	
	this->gradientBackground = new SoGradientBackground();
	this->gradientBackground->ref();
	this->gradientBackground->color0.setValue(0.8f, 0.8f, 0.8f);
	this->gradientBackground->color1.setValue(1.0f, 1.0f, 1.0f);
	this->scene->root->insertChild(this->gradientBackground, 0);
	
	this->viewer = new SoQtExaminerViewer(this, nullptr, true, SoQtFullViewer::BUILD_POPUP);
	this->viewer->setSceneGraph(this->scene->root);
	this->viewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_BLEND);
	this->viewer->viewAll();
	
	this->resize(1024, 768);
	this->setCentralWidget(this->viewer->getWidget());
	this->setWindowIconText("rlCoachMdl");
	this->setWindowTitle("rlCoachMdl");
	
	this->init();
	
	this->server->listen(QHostAddress::Any, 11235);
}
Example #10
0
int main(int argc, char *argv[])
{
	QApplication app(argc, argv);
	QWidget * main_wg = new QWidget;

	// cria um objeto "splitter" para compartilhar widgets:    
	QSplitter *splitter = new QSplitter(main_wg);

	// cria um "model" usando o "StandardModel"
	QStandardItemModel *model = new QStandardItemModel;

	const int totCols = 3;
	int col;
	// define os títulos das colunas:
	for (col = 0; col < totCols; ++col) 
	{
		model->setHorizontalHeaderItem(col, 
			new QStandardItem( QString("COL-%1").arg(col+1) ) );
	}
	
	// alimenta linhas, colunas e sub-níveis:	
	QStandardItem *parentItem = model->invisibleRootItem();
	
	const int iniLevel = 0;
	const int totLevels= 3;
	QString prevRows("");
	QVector<QSize> vec_ColsRows; // colunas, linhas de cada nível 
	vec_ColsRows.reserve( totLevels );	
				// quantidade-colunas, quantidade-linhas
	vec_ColsRows << QSize(3,10) << QSize(3,3) << QSize(3,2) ;
	populate_model ( parentItem, vec_ColsRows,
						 iniLevel, prevRows);
	
	// Neste exemplo,
	// O "model" foi alimentado com linhas, colunas e sub-níveis:
	// E serão criadas 4 "views" (uma "tree", uma "table", uma "list" e uma "comboBox")
	// relacionadas ao mesmo "model";
	// Cada "view" exibe os dados de uma determinada maneira;

	// 1- ==== a primeira "view" é uma "tree":
	QTreeView *tree = new QTreeView(splitter);
	tree->setModel(model);
	// habilita classificação na tree:
	tree->setSortingEnabled(true);
	// classifica
	tree->sortByColumn(0);	
	// expande toda a árvore:
	tree->expandAll();
	// força largura de todas as colunas
	// para exibição completa do texto dos seus itens
	for (col = 0; col < totCols; ++col)
		tree->resizeColumnToContents(col);

	// configura o header para permitir mudança na ordem de classificacão:
	QHeaderView * hdrTree = tree->header();
	hdrTree->setClickable (true);
	hdrTree->setSortIndicator(0,Qt::AscendingOrder);
	hdrTree->setSortIndicatorShown(true);
	hdrTree->setMovable(true); // permite mover colunas do header

	// 2- ==== a segunda "view" é uma "table"
	QTableView *table = new QTableView(splitter);
	table->setModel(model);
	table->setAlternatingRowColors(true);
	// habilita classificação na table:
	table->setSortingEnabled(true);
	// classifica
	table->sortByColumn(0);	

	// configura o header para permitir mudança na ordem de classificacão:
	QHeaderView * hdrTable = table->horizontalHeader();
	hdrTable->setClickable (true);
	hdrTable->setSortIndicator(0,Qt::AscendingOrder);
	hdrTable->setSortIndicatorShown(true);
	hdrTable->setMovable(true); // permite mover colunas do header
			
	// 3- ==== a terceira view é uma "list": 
	QListView *list = new QListView(splitter);
	list->setModel(model);

	// 4- ==== a quarta "view" é uma "comboBox"
	QComboBox *combo = new QComboBox;
	combo->setModel(model);

	// configura a "splitter" definindo a largura de cada "view"
	int width = 800;	
	QList< int > cols;
	cols << int(width* 0.45) << int(width*0.45) << int(width*0.1);
	splitter->setSizes(cols);	

	// layout para agrupar a "combo" e a "splitter":
	QGridLayout * glayMain = new QGridLayout;
	main_wg->setLayout( glayMain);
	glayMain->addWidget( combo, 0, 1); // linha 0, coluna 0;
	glayMain->setRowMinimumHeight(1, glayMain->verticalSpacing() * 4); // linha 1: linha de separação
	glayMain->addWidget( splitter, 2, 0, 1, 3 ); // linha 2, coluna 0, rowSpan 1, colSpan 3

	main_wg->setWindowTitle("06_standard - 4 'views' usando o mesmo 'model' (StandardModel) - recursivo");
	main_wg->resize(800,500);	

	main_wg->show();
	return app.exec();
}
Example #11
0
TransactionView::TransactionView(QWidget *parent) :
    QWidget(parent), model(0), transactionProxyModel(0),
    transactionView(0)
{

    // Build filter row
    setContentsMargins(0,0,0,0);

    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setContentsMargins(0,0,0,0);

#ifdef Q_OS_MAC
    hlayout->setSpacing(5);
    hlayout->addSpacing(0);
#else
    hlayout->setSpacing(0);
    hlayout->addSpacing(0);
#endif

    dateWidget = new QComboBox(this);
    dateWidget->setContentsMargins(1,1,1,1);

#ifdef Q_OS_MAC
    dateWidget->setFixedWidth(121);
#else
    dateWidget->setFixedWidth(120);    
#endif

    dateWidget->setContentsMargins(1,1,1,1);
    dateWidget->addItem(tr("All"), All);
    dateWidget->addItem(tr("Today"), Today);
    dateWidget->addItem(tr("This week"), ThisWeek);
    dateWidget->addItem(tr("This month"), ThisMonth);
    dateWidget->addItem(tr("Last month"), LastMonth);
    dateWidget->addItem(tr("This year"), ThisYear);
    dateWidget->addItem(tr("Range..."), Range);
    hlayout->addWidget(dateWidget);

    typeWidget = new QComboBox(this);

#ifdef Q_OS_MAC
    typeWidget->setFixedWidth(121);
#else
    typeWidget->setFixedWidth(120);
#endif
    typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES);
    typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) |
                                        TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther));
    typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) |
                                  TransactionFilterProxy::TYPE(TransactionRecord::SendToOther));
    typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf));
    typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated));
    typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other));
    typeWidget->setContentsMargins(1,1,1,1);
    hlayout->addWidget(typeWidget);

    addressWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    addressWidget->setPlaceholderText(tr("Enter address or label to search"));
    addressWidget->setContentsMargins(1,1,1,1);
#endif
    hlayout->addWidget(addressWidget);

    amountWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    amountWidget->setPlaceholderText(tr("Min amount"));
    amountWidget->setContentsMargins(1,1,1,1);
#endif
#ifdef Q_OS_MAC
    amountWidget->setFixedWidth(97);
#else
    amountWidget->setFixedWidth(100);
#endif
    amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this));
    hlayout->addWidget(amountWidget);

    QVBoxLayout *vlayout = new QVBoxLayout(this);
    vlayout->setContentsMargins(0,0,0,0);
    vlayout->setSpacing(0);

    QTableView *view = new QTableView(this);
    vlayout->addLayout(hlayout);
    vlayout->addWidget(createDateRangeWidget());
    vlayout->addWidget(view);
    vlayout->setSpacing(0);
    view->setAlternatingRowColors(false);
    int width = view->verticalScrollBar()->sizeHint().width();
    // Cover scroll bar width with spacing
#ifdef Q_OS_MAC
    hlayout->addSpacing(width+2);
#else
    hlayout->addSpacing(width);
#endif
    // Always show scroll bar
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    view->setTabKeyNavigation(false);
    view->setContextMenuPolicy(Qt::CustomContextMenu);

    transactionView = view;

    // Actions

    QAction *copyAddressAction = new QAction(tr("Copy address"), this);
    QAction *copyLabelAction = new QAction(tr("Copy label"), this);
    QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
    QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
    QAction *editLabelAction = new QAction(tr("Edit label"), this);
    QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);
    QAction *viewOnPandachain = new QAction(tr("Show transaction on the Netcoin Block Explorer"), this);

    contextMenu = new QMenu();
    contextMenu->addAction(copyAddressAction);
    contextMenu->addAction(copyLabelAction);
    contextMenu->addAction(copyAmountAction);
    contextMenu->addAction(copyTxIDAction);
    contextMenu->addSeparator();
    contextMenu->addAction(editLabelAction);
    contextMenu->addAction(showDetailsAction);
    contextMenu->addSeparator();
    contextMenu->addAction(viewOnPandachain);

    // Connect actions
    connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
    connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
    connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString)));
    connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));

    connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
    connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));

    connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
    connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
    connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
    connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
    connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
    connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
    connect(viewOnPandachain, SIGNAL(triggered()), this, SLOT(viewOnPandachain()));
}