source: terepaima/terepaima-0.4.16/sources/fontsdialog.cpp

desarrollostretch
Last change on this file was 1f4adec, checked in by aosorio <aosorio@…>, 8 years ago

Agregado proyecto base, esto luego del dh_make -f

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2
3Copyright 2013 Adam Reichold
4
5This file is part of qpdfview.
6
7qpdfview is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12qpdfview is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with qpdfview.  If not, see <http://www.gnu.org/licenses/>.
19
20*/
21
22#include "fontsdialog.h"
23
24#include <QDialogButtonBox>
25#include <QHeaderView>
26#include <QStandardItemModel>
27#include <QTableView>
28#include <QVBoxLayout>
29
30#include "settings.h"
31
32namespace qpdfview
33{
34
35FontsDialog::FontsDialog(QStandardItemModel* model, QWidget* parent) : QDialog(parent)
36{
37    setWindowTitle(tr("Fonts") + QLatin1String(" - qpdfview"));
38
39    m_tableView = new QTableView(this);
40    m_tableView->setModel(model);
41
42    m_tableView->setAlternatingRowColors(true);
43    m_tableView->setSortingEnabled(true);
44    m_tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
45    m_tableView->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
46
47#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
48
49    m_tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
50    m_tableView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
51
52#else
53
54    m_tableView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
55    m_tableView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
56
57#endif // QT_VERSION
58
59    m_tableView->verticalHeader()->setVisible(false);
60
61    m_dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, this);
62    connect(m_dialogButtonBox, SIGNAL(accepted()), SLOT(accept()));
63    connect(m_dialogButtonBox, SIGNAL(rejected()), SLOT(reject()));
64
65    setLayout(new QVBoxLayout(this));
66    layout()->addWidget(m_tableView);
67    layout()->addWidget(m_dialogButtonBox);
68
69    resize(Settings::instance()->mainWindow().fontsDialogSize(sizeHint()));
70}
71
72FontsDialog::~FontsDialog()
73{
74    Settings::instance()->mainWindow().setFontsDialogSize(size());
75}
76
77} // qpdfview
Note: See TracBrowser for help on using the repository browser.