• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

KPIMTextedit Library

  • kpimtextedit
tableformatdialog.cpp
1 /*
2  Copyright (c) 2012 Montel Laurent <montel@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 
19 */
20 
21 #include "tableformatdialog.h"
22 #include "inserttabledialog.h"
23 
24 #include <KLocale>
25 #include <KComboBox>
26 #include <KSeparator>
27 
28 #include <QVBoxLayout>
29 #include <QHBoxLayout>
30 #include <QSpinBox>
31 #include <QLabel>
32 
33 using namespace KPIMTextEdit;
34 
35 class TableFormatDialog::TableFormatDialogPrivate
36 {
37 public:
38  TableFormatDialogPrivate(TableFormatDialog *qq)
39  :q( qq )
40  {
41  q->setCaption( i18n( "Table Format" ) );
42  q->setButtons( Ok|Cancel );
43  QWidget *page = new QWidget( q );
44  q->setMainWidget( page );
45  QVBoxLayout *lay = new QVBoxLayout( page );
46  tableWidget = new InsertTableWidget;
47  lay->addWidget( tableWidget );
48 
49  KSeparator *sep = new KSeparator;
50  lay->addWidget( sep );
51 
52  QHBoxLayout *hbox = new QHBoxLayout;
53  QLabel *lab = new QLabel( i18n( "Spacing:" ) );
54  hbox->addWidget( lab );
55  spacing = new QSpinBox;
56  spacing->setMinimum( 0 );
57  hbox->addWidget( spacing );
58  lab = new QLabel( i18n( "pixels between cells" ) );
59  hbox->addWidget( lab );
60  lay->addLayout( hbox );
61 
62  hbox = new QHBoxLayout;
63  lab = new QLabel( i18n( "Padding:" ) );
64  hbox->addWidget( lab );
65  padding = new QSpinBox;
66  padding->setMinimum( 0 );
67  hbox->addWidget( padding );
68  lab = new QLabel( i18n( "pixels between cell border and content" ) );
69  hbox->addWidget( lab );
70  lay->addLayout( hbox );
71 
72  sep = new KSeparator;
73  lay->addWidget( sep );
74 
75  alignment = new KComboBox;
76  alignment->addItem( i18n( "Left" ), Qt::AlignLeft );
77  alignment->addItem( i18n( "Right" ), Qt::AlignRight );
78  alignment->addItem( i18n( "Center" ), Qt::AlignHCenter );
79  alignment->addItem( i18n( "Justify" ), Qt::AlignJustify );
80 
81  hbox = new QHBoxLayout;
82  lab = new QLabel( i18n( "Table Alignment:" ) );
83  hbox->addWidget( lab );
84  hbox->addWidget( alignment );
85 
86  lay->addLayout( hbox );
87 
88  }
89  KComboBox *alignment;
90  QSpinBox *spacing;
91  QSpinBox *padding;
92  KPIMTextEdit::InsertTableWidget *tableWidget;
93  TableFormatDialog *q;
94 };
95 
96 TableFormatDialog::TableFormatDialog(QWidget *parent)
97  : KDialog( parent ), d( new TableFormatDialogPrivate( this ) )
98 {
99 }
100 
101 TableFormatDialog::~TableFormatDialog()
102 {
103  delete d;
104 }
105 
106 int TableFormatDialog::columns() const
107 {
108  return d->tableWidget->columns();
109 }
110 
111 int TableFormatDialog::rows() const
112 {
113  return d->tableWidget->rows();
114 }
115 
116 int TableFormatDialog::border() const
117 {
118  return d->tableWidget->border();
119 }
120 
121 void TableFormatDialog::setColumns(int col)
122 {
123  d->tableWidget->setColumns( col );
124 }
125 
126 void TableFormatDialog::setRows(int row)
127 {
128  d->tableWidget->setRows( row );
129 }
130 
131 void TableFormatDialog::setBorder(int border)
132 {
133  d->tableWidget->setBorder( border );
134 }
135 
136 int TableFormatDialog::padding() const
137 {
138  return d->padding->value();
139 }
140 
141 void TableFormatDialog::setPadding(int value)
142 {
143  d->padding->setValue( value );
144 }
145 
146 int TableFormatDialog::spacing() const
147 {
148  return d->spacing->value();
149 }
150 
151 void TableFormatDialog::setSpacing(int value)
152 {
153  d->spacing->setValue( value );
154 }
155 
156 void TableFormatDialog::setAlignment(Qt::Alignment alignment)
157 {
158  d->alignment->setCurrentIndex( d->alignment->findData( QVariant( alignment ) ) );
159 }
160 
161 Qt::Alignment TableFormatDialog::alignment() const
162 {
163  return ( Qt::Alignment )d->alignment->itemData( d->alignment->currentIndex () ).toInt();
164 }
165 
166 
167 QTextLength::Type TableFormatDialog::typeOfLength() const
168 {
169  return d->tableWidget->typeOfLength();
170 }
171 
172 int TableFormatDialog::length() const
173 {
174  return d->tableWidget->length();
175 }
176 
177 void TableFormatDialog::setLength(int val)
178 {
179  d->tableWidget->setLength(val);
180 }
181 
182 void TableFormatDialog::setTypeOfLength(QTextLength::Type type)
183 {
184  d->tableWidget->setTypeOfLength(type);
185 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:26:01 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KPIMTextedit Library

Skip menu "KPIMTextedit Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal