~ubuntu-branches/ubuntu/maverick/freecad/maverick

« back to all changes in this revision

Viewing changes to src/Tools/plugins/widget/customwidgets.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-07-16 18:37:41 UTC
  • Revision ID: james.westby@ubuntu.com-20090716183741-oww9kcxqrk991i1n
Tags: upstream-0.8.2237
ImportĀ upstreamĀ versionĀ 0.8.2237

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (c) 2006 Werner Mayer <werner.wm.mayer@gmx.de>              *
 
3
 *                                                                         *
 
4
 *   This file is part of the FreeCAD CAx development system.              *
 
5
 *                                                                         *
 
6
 *   This library is free software; you can redistribute it and/or         *
 
7
 *   modify it under the terms of the GNU Library General Public           *
 
8
 *   License as published by the Free Software Foundation; either          *
 
9
 *   version 2 of the License, or (at your option) any later version.      *
 
10
 *                                                                         *
 
11
 *   This library  is distributed in the hope that it will be useful,      *
 
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
14
 *   GNU Library General Public License for more details.                  *
 
15
 *                                                                         *
 
16
 *   You should have received a copy of the GNU Library General Public     *
 
17
 *   License along with this library; see the file COPYING.LIB. If not,    *
 
18
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
 
19
 *   Suite 330, Boston, MA  02111-1307, USA                                *
 
20
 *                                                                         *
 
21
 ***************************************************************************/
 
22
 
 
23
 
 
24
#include <QtGui>
 
25
#include <QCursor>
 
26
#include <QFileDialog>
 
27
#include <QMessageBox>
 
28
#include <QStyleOptionButton>
 
29
#include <QStylePainter>
 
30
 
 
31
#include "customwidgets.h"
 
32
 
 
33
using namespace Gui;
 
34
 
 
35
 
 
36
UrlLabel::UrlLabel ( QWidget * parent, Qt::WFlags f )
 
37
  : QLabel("TextLabel", parent, f)
 
38
{
 
39
    _url = "http://localhost";
 
40
    setToolTip(this->_url);
 
41
}
 
42
 
 
43
UrlLabel::~UrlLabel()
 
44
{
 
45
}
 
46
 
 
47
void UrlLabel::enterEvent ( QEvent * )
 
48
{
 
49
    setCursor(Qt::PointingHandCursor);
 
50
}
 
51
 
 
52
void UrlLabel::leaveEvent ( QEvent * )
 
53
{
 
54
    setCursor(Qt::ArrowCursor);
 
55
}
 
56
 
 
57
void UrlLabel::mouseReleaseEvent ( QMouseEvent * )
 
58
{
 
59
    QMessageBox::information(this, "Browser", 
 
60
        QString("This starts your browser with url %1").arg(_url));
 
61
}
 
62
 
 
63
QString UrlLabel::url() const
 
64
{
 
65
    return this->_url;
 
66
}
 
67
 
 
68
void UrlLabel::setUrl(const QString& u)
 
69
{
 
70
    this->_url = u;
 
71
    setToolTip(this->_url);
 
72
}
 
73
 
 
74
FileChooser::FileChooser( QWidget *parent )
 
75
  : QWidget( parent ), md( File ), _filter( QString::null )
 
76
{
 
77
    QHBoxLayout *layout = new QHBoxLayout( this );
 
78
    layout->setMargin( 0 );
 
79
    layout->setSpacing( 6 );
 
80
 
 
81
    lineEdit = new QLineEdit( this );
 
82
    layout->addWidget( lineEdit );
 
83
 
 
84
    connect(lineEdit, SIGNAL(textChanged(const QString &)),
 
85
            this, SIGNAL(fileNameChanged(const QString &)));
 
86
 
 
87
    button = new QPushButton( "...", this );
 
88
    button->setFixedWidth(2*button->fontMetrics().width( " ... " ));
 
89
    layout->addWidget( button );
 
90
 
 
91
    connect(button, SIGNAL(clicked()), this, SLOT(chooseFile()));
 
92
 
 
93
    setFocusProxy( lineEdit );
 
94
}
 
95
 
 
96
FileChooser::~FileChooser()
 
97
{
 
98
}
 
99
 
 
100
QString FileChooser::fileName() const
 
101
{
 
102
    return lineEdit->text();
 
103
}
 
104
 
 
105
void FileChooser::setFileName( const QString &fn )
 
106
{
 
107
    lineEdit->setText( fn );
 
108
}
 
109
 
 
110
void FileChooser::chooseFile()
 
111
{
 
112
    QString fn;
 
113
    if ( mode() == File )
 
114
        fn = QFileDialog::getOpenFileName(this, tr("Select a file"),
 
115
        lineEdit->text(), _filter);
 
116
    else
 
117
        fn = QFileDialog::getExistingDirectory(this, tr("Select a directory"),
 
118
        lineEdit->text() );
 
119
 
 
120
    if (!fn.isEmpty()) {
 
121
        lineEdit->setText(fn);
 
122
        emit fileNameSelected(fn);
 
123
    }
 
124
}
 
125
 
 
126
FileChooser::Mode FileChooser::mode() const
 
127
{
 
128
    return md;
 
129
}
 
130
 
 
131
void FileChooser::setMode( Mode m )
 
132
{
 
133
    md = m;
 
134
}
 
135
 
 
136
QString FileChooser::filter() const
 
137
{
 
138
    return _filter;
 
139
}
 
140
 
 
141
void FileChooser::setFilter ( const QString& filter )
 
142
{
 
143
    _filter = filter;
 
144
}
 
145
 
 
146
void FileChooser::setButtonText( const QString& txt )
 
147
{
 
148
    button->setText( txt );
 
149
    int w1 = 2*button->fontMetrics().width(txt);
 
150
    int w2 = 2*button->fontMetrics().width(" ... ");
 
151
    button->setFixedWidth((w1 > w2 ? w1 : w2));
 
152
}
 
153
 
 
154
QString FileChooser::buttonText() const
 
155
{
 
156
    return button->text();
 
157
}
 
158
 
 
159
// ------------------------------------------------------------------------------
 
160
 
 
161
PrefFileChooser::PrefFileChooser ( QWidget * parent )
 
162
  : FileChooser(parent)
 
163
{
 
164
}
 
165
 
 
166
PrefFileChooser::~PrefFileChooser()
 
167
{
 
168
}
 
169
 
 
170
QByteArray PrefFileChooser::entryName () const
 
171
{
 
172
    return m_sPrefName;
 
173
}
 
174
 
 
175
QByteArray PrefFileChooser::paramGrpPath () const
 
176
{
 
177
    return m_sPrefGrp;
 
178
}
 
179
 
 
180
void PrefFileChooser::setEntryName ( const QByteArray& name )
 
181
{
 
182
    m_sPrefName = name;
 
183
}
 
184
 
 
185
void PrefFileChooser::setParamGrpPath ( const QByteArray& name )
 
186
{
 
187
    m_sPrefGrp = name;
 
188
}
 
189
 
 
190
// --------------------------------------------------------------------
 
191
 
 
192
AccelLineEdit::AccelLineEdit ( QWidget * parent )
 
193
  : QLineEdit(parent)
 
194
{
 
195
    setText(tr("none"));
 
196
}
 
197
 
 
198
void AccelLineEdit::keyPressEvent ( QKeyEvent * e)
 
199
{
 
200
    QString txt;
 
201
    setText(tr("none"));
 
202
 
 
203
    int key = e->key();
 
204
    Qt::KeyboardModifiers state = e->modifiers();
 
205
 
 
206
    if ( key == Qt::Key_Control )
 
207
        return;
 
208
    else if ( key == Qt::Key_Shift )
 
209
        return;
 
210
    else if ( key == Qt::Key_Alt )
 
211
        return;
 
212
    else if ( state == Qt::NoModifier && key == Qt::Key_Backspace )
 
213
        return; // clears the edit field
 
214
 
 
215
    switch( state )
 
216
    {
 
217
    case Qt::ControlModifier:
 
218
        {
 
219
            QKeySequence key(Qt::CTRL+key);
 
220
            txt += (QString)(key);
 
221
            setText(txt);
 
222
        }   break;
 
223
    case Qt::AltModifier:
 
224
        {
 
225
            QKeySequence key(Qt::ALT+key);
 
226
            txt += (QString)(key);
 
227
            setText(txt);
 
228
        }   break;
 
229
    case Qt::ShiftModifier:
 
230
        {
 
231
            QKeySequence key(Qt::SHIFT+key);
 
232
            txt += (QString)(key);
 
233
            setText(txt);
 
234
        }   break;
 
235
    case Qt::ControlModifier+Qt::AltModifier:
 
236
        {
 
237
            QKeySequence key(Qt::CTRL+Qt::ALT+key);
 
238
            txt += (QString)(key);
 
239
            setText(txt);
 
240
        }   break;
 
241
    case Qt::ControlModifier+Qt::ShiftModifier:
 
242
        {
 
243
            QKeySequence key(Qt::CTRL+Qt::SHIFT+key);
 
244
            txt += (QString)(key);
 
245
            setText(txt);
 
246
        }   break;
 
247
    case Qt::ShiftModifier+Qt::AltModifier:
 
248
        {
 
249
            QKeySequence key(Qt::SHIFT+Qt::ALT+key);
 
250
            txt += (QString)(key);
 
251
            setText(txt);
 
252
        }   break;
 
253
    case Qt::ControlModifier+Qt::AltModifier+Qt::ShiftModifier:
 
254
        {
 
255
            QKeySequence key(Qt::CTRL+Qt::ALT+Qt::SHIFT+key);
 
256
            txt += (QString)(key);
 
257
            setText(txt);
 
258
        }   break;
 
259
    default:
 
260
        {
 
261
            QKeySequence key(key);
 
262
            txt += (QString)(key);
 
263
            setText(txt);
 
264
        }   break;
 
265
    }
 
266
}
 
267
 
 
268
// ------------------------------------------------------------------------------
 
269
 
 
270
CommandIconView::CommandIconView ( QWidget * parent )
 
271
  : QListWidget(parent)
 
272
{
 
273
    connect(this, SIGNAL (currentItemChanged(QListWidgetItem *, QListWidgetItem *)), 
 
274
            this, SLOT (onSelectionChanged(QListWidgetItem *, QListWidgetItem *)) );
 
275
}
 
276
 
 
277
CommandIconView::~CommandIconView ()
 
278
{
 
279
}
 
280
 
 
281
void CommandIconView::startDrag ( Qt::DropActions /*supportedActions*/ )
 
282
{
 
283
    QList<QListWidgetItem*> items = selectedItems();
 
284
    QByteArray itemData;
 
285
    QDataStream dataStream(&itemData, QIODevice::WriteOnly);
 
286
 
 
287
    QPixmap pixmap;
 
288
    dataStream << items.count();
 
289
    for (QList<QListWidgetItem*>::ConstIterator it = items.begin(); it != items.end(); ++it) {
 
290
        if (it == items.begin())
 
291
            pixmap = qVariantValue<QPixmap>((*it)->data(Qt::UserRole));
 
292
        dataStream << (*it)->text();
 
293
    }
 
294
 
 
295
    QMimeData *mimeData = new QMimeData;
 
296
    mimeData->setData("text/x-action-items", itemData);
 
297
 
 
298
    QDrag *drag = new QDrag(this);
 
299
    drag->setMimeData(mimeData);
 
300
    drag->setHotSpot(QPoint(pixmap.width()/2, pixmap.height()/2));
 
301
    drag->setPixmap(pixmap);
 
302
    drag->start(Qt::MoveAction);
 
303
}
 
304
 
 
305
void CommandIconView::onSelectionChanged(QListWidgetItem * item, QListWidgetItem *)
 
306
{
 
307
    if (item)
 
308
        emitSelectionChanged(item->toolTip());
 
309
}
 
310
 
 
311
// ------------------------------------------------------------------------------
 
312
 
 
313
namespace Gui {
 
314
 
 
315
class UnsignedValidator : public QValidator
 
316
{
 
317
public:
 
318
    UnsignedValidator( QObject * parent );
 
319
    UnsignedValidator( uint minimum, uint maximum, QObject * parent );
 
320
    ~UnsignedValidator();
 
321
 
 
322
    QValidator::State validate( QString &, int & ) const;
 
323
 
 
324
    void setBottom( uint );
 
325
    void setTop( uint );
 
326
    virtual void setRange( uint bottom, uint top );
 
327
 
 
328
    uint bottom() const { return b; }
 
329
    uint top() const { return t; }
 
330
 
 
331
private:
 
332
    uint b, t;
 
333
};
 
334
 
 
335
UnsignedValidator::UnsignedValidator( QObject * parent )
 
336
  : QValidator( parent )
 
337
{
 
338
    b =  0;
 
339
    t =  UINT_MAX;
 
340
}
 
341
 
 
342
UnsignedValidator::UnsignedValidator( uint minimum, uint maximum, QObject * parent )
 
343
  : QValidator( parent )
 
344
{
 
345
    b = minimum;
 
346
    t = maximum;
 
347
}
 
348
 
 
349
UnsignedValidator::~UnsignedValidator()
 
350
{
 
351
 
 
352
}
 
353
 
 
354
QValidator::State UnsignedValidator::validate( QString & input, int & ) const
 
355
{
 
356
    QString stripped;// = input.stripWhiteSpace();
 
357
    if ( stripped.isEmpty() )
 
358
        return Intermediate;
 
359
    bool ok;
 
360
    uint entered = input.toUInt( &ok );
 
361
    if ( !ok )
 
362
        return Invalid;
 
363
    else if ( entered < b )
 
364
        return Intermediate;
 
365
    else if ( entered > t )
 
366
        return Invalid;
 
367
//  else if ( entered < b || entered > t )
 
368
//        return Invalid;
 
369
    else
 
370
        return Acceptable;
 
371
}
 
372
 
 
373
void UnsignedValidator::setRange( uint minimum, uint maximum )
 
374
{
 
375
    b = minimum;
 
376
    t = maximum;
 
377
}
 
378
 
 
379
void UnsignedValidator::setBottom( uint bottom )
 
380
{
 
381
    setRange( bottom, top() );
 
382
}
 
383
 
 
384
void UnsignedValidator::setTop( uint top )
 
385
{
 
386
    setRange( bottom(), top );
 
387
}
 
388
 
 
389
class UIntSpinBoxPrivate
 
390
{
 
391
public:
 
392
    UnsignedValidator * mValidator;
 
393
 
 
394
    UIntSpinBoxPrivate() : mValidator(0)
 
395
    {
 
396
    }
 
397
    uint mapToUInt( int v ) const
 
398
    {
 
399
        uint ui;
 
400
        if ( v == INT_MIN ) {
 
401
            ui = 0;
 
402
        }
 
403
        else if ( v == INT_MAX ) {
 
404
            ui = UINT_MAX;
 
405
        }
 
406
        else if ( v < 0 ) {
 
407
            v -= INT_MIN; ui = (uint)v;
 
408
        }
 
409
        else {
 
410
            ui = (uint)v; ui -= INT_MIN;
 
411
        }
 
412
        return ui;
 
413
    }
 
414
    int mapToInt( uint v ) const
 
415
    {
 
416
        int in;
 
417
        if ( v == UINT_MAX ) {
 
418
            in = INT_MAX;
 
419
        }
 
420
        else if ( v == 0 ) {
 
421
            in = INT_MIN;
 
422
        }
 
423
        else if ( v > INT_MAX ) {
 
424
            v += INT_MIN; in = (int)v;
 
425
        }
 
426
        else {
 
427
            in = v; in += INT_MIN;
 
428
        }
 
429
        return in;
 
430
    }
 
431
};
 
432
 
 
433
} // namespace Gui
 
434
 
 
435
// -------------------------------------------------------------
 
436
 
 
437
UIntSpinBox::UIntSpinBox (QWidget* parent)
 
438
  : QSpinBox (parent)
 
439
{
 
440
    d = new UIntSpinBoxPrivate;
 
441
    d->mValidator =  new UnsignedValidator(this->minimum(), this->maximum(), this);
 
442
    connect(this, SIGNAL(valueChanged(int)),
 
443
            this, SLOT(valueChange(int)));
 
444
    setRange(0, 99);
 
445
    setValue(0);
 
446
    updateValidator();
 
447
}
 
448
 
 
449
UIntSpinBox::~UIntSpinBox()
 
450
{
 
451
    delete d->mValidator;
 
452
    delete d; d = 0;
 
453
}
 
454
 
 
455
void UIntSpinBox::setRange(uint minVal, uint maxVal)
 
456
{
 
457
    int iminVal = d->mapToInt(minVal);
 
458
    int imaxVal = d->mapToInt(maxVal);
 
459
    QSpinBox::setRange(iminVal, imaxVal);
 
460
    updateValidator();
 
461
}
 
462
 
 
463
QValidator::State UIntSpinBox::validate (QString & input, int & pos) const
 
464
{
 
465
    return d->mValidator->validate(input, pos);
 
466
}
 
467
 
 
468
uint UIntSpinBox::value() const
 
469
{
 
470
    return d->mapToUInt(QSpinBox::value());
 
471
}
 
472
 
 
473
void UIntSpinBox::setValue(uint value)
 
474
{
 
475
    QSpinBox::setValue(d->mapToInt(value));
 
476
}
 
477
 
 
478
void UIntSpinBox::valueChange(int value)
 
479
{
 
480
    valueChanged(d->mapToUInt(value));
 
481
}
 
482
 
 
483
uint UIntSpinBox::minimum() const
 
484
{
 
485
    return d->mapToUInt(QSpinBox::minimum());
 
486
}
 
487
 
 
488
void UIntSpinBox::setMinimum(uint minVal)
 
489
{
 
490
    uint maxVal = maximum();
 
491
    if (maxVal < minVal)
 
492
        maxVal = minVal;
 
493
    setRange(minVal, maxVal);
 
494
}
 
495
 
 
496
uint UIntSpinBox::maximum() const
 
497
{
 
498
    return d->mapToUInt(QSpinBox::maximum());
 
499
}
 
500
 
 
501
void UIntSpinBox::setMaximum(uint maxVal)
 
502
{
 
503
    uint minVal = minimum();
 
504
    if (minVal > maxVal)
 
505
        minVal = maxVal;
 
506
    setRange(minVal, maxVal);
 
507
}
 
508
 
 
509
QString UIntSpinBox::textFromValue (int v) const
 
510
{
 
511
    uint val = d->mapToUInt(v);
 
512
    QString s;
 
513
    s.setNum(val);
 
514
    return s;
 
515
}
 
516
 
 
517
int UIntSpinBox::valueFromText (const QString & text) const
 
518
{
 
519
    bool ok;
 
520
    QString s = text;
 
521
    uint newVal = s.toUInt(&ok);
 
522
    if (!ok && !(prefix().isEmpty() && suffix().isEmpty())) {
 
523
        s = cleanText();
 
524
        newVal = s.toUInt(&ok);
 
525
    }
 
526
 
 
527
    return d->mapToInt(newVal);
 
528
}
 
529
 
 
530
void UIntSpinBox::updateValidator() 
 
531
{
 
532
    d->mValidator->setRange(this->minimum(), this->maximum());
 
533
}
 
534
 
 
535
// --------------------------------------------------------------------
 
536
 
 
537
PrefSpinBox::PrefSpinBox ( QWidget * parent )
 
538
  : QSpinBox(parent)
 
539
{
 
540
}
 
541
 
 
542
PrefSpinBox::~PrefSpinBox()
 
543
{
 
544
}
 
545
 
 
546
QByteArray PrefSpinBox::entryName () const
 
547
{
 
548
    return m_sPrefName;
 
549
}
 
550
 
 
551
QByteArray PrefSpinBox::paramGrpPath () const
 
552
{
 
553
    return m_sPrefGrp;
 
554
}
 
555
 
 
556
void PrefSpinBox::setEntryName ( const QByteArray& name )
 
557
{
 
558
    m_sPrefName = name;
 
559
}
 
560
 
 
561
void PrefSpinBox::setParamGrpPath ( const QByteArray& name )
 
562
{
 
563
    m_sPrefGrp = name;
 
564
}
 
565
 
 
566
// --------------------------------------------------------------------
 
567
 
 
568
PrefDoubleSpinBox::PrefDoubleSpinBox ( QWidget * parent )
 
569
  : QDoubleSpinBox(parent)
 
570
{
 
571
}
 
572
 
 
573
PrefDoubleSpinBox::~PrefDoubleSpinBox()
 
574
{
 
575
}
 
576
 
 
577
QByteArray PrefDoubleSpinBox::entryName () const
 
578
{
 
579
    return m_sPrefName;
 
580
}
 
581
 
 
582
QByteArray PrefDoubleSpinBox::paramGrpPath () const
 
583
{
 
584
    return m_sPrefGrp;
 
585
}
 
586
 
 
587
void PrefDoubleSpinBox::setEntryName ( const QByteArray& name )
 
588
{
 
589
    m_sPrefName = name;
 
590
}
 
591
 
 
592
void PrefDoubleSpinBox::setParamGrpPath ( const QByteArray& name )
 
593
{
 
594
    m_sPrefGrp = name;
 
595
}
 
596
 
 
597
// -------------------------------------------------------------
 
598
 
 
599
ColorButton::ColorButton(QWidget* parent)
 
600
    : QPushButton( parent ), _allowChange(true), _drawFrame(true)
 
601
{
 
602
    _col = palette().color(QPalette::Active,QPalette::Midlight);
 
603
    connect( this, SIGNAL( clicked() ), SLOT( onChooseColor() ));
 
604
}
 
605
 
 
606
ColorButton::~ColorButton()
 
607
{
 
608
}
 
609
 
 
610
void ColorButton::setColor( const QColor& c )
 
611
{
 
612
    _col = c;
 
613
    update();
 
614
}
 
615
 
 
616
QColor ColorButton::color() const
 
617
{
 
618
    return _col;
 
619
}
 
620
 
 
621
void ColorButton::setAllowChangeColor(bool ok)
 
622
{
 
623
    _allowChange = ok;
 
624
}
 
625
 
 
626
bool ColorButton::allowChangeColor() const
 
627
{
 
628
    return _allowChange;
 
629
}
 
630
 
 
631
void ColorButton::setDrawFrame(bool ok)
 
632
{
 
633
    _drawFrame = ok;
 
634
}
 
635
 
 
636
bool ColorButton::drawFrame() const
 
637
{
 
638
    return _drawFrame;
 
639
}
 
640
 
 
641
void ColorButton::paintEvent ( QPaintEvent * e )
 
642
{
 
643
    // first paint the complete button
 
644
    QPushButton::paintEvent(e);
 
645
 
 
646
    // repaint the rectangle area
 
647
    QPalette::ColorGroup group = isEnabled() ? hasFocus() ? QPalette::Active : QPalette::Inactive : QPalette::Disabled;
 
648
    QColor pen = palette().color(group,QPalette::ButtonText);
 
649
    {
 
650
        QPainter paint(this);
 
651
        paint.setPen( pen );
 
652
 
 
653
        if (_drawFrame) {
 
654
            paint.setBrush(QBrush(_col));
 
655
            paint.drawRect(5, 5, width()-10, height()-10);
 
656
        } else {
 
657
            paint.fillRect(5, 5, width()-10, height()-10, QBrush(_col));
 
658
        }
 
659
    }
 
660
 
 
661
    // overpaint the rectangle to paint icon and text 
 
662
    QStyleOptionButton opt;
 
663
    opt.init(this);
 
664
    opt.text = text();
 
665
    opt.icon = icon();
 
666
    opt.iconSize = iconSize();
 
667
 
 
668
    QStylePainter p(this);
 
669
    p.drawControl(QStyle::CE_PushButtonLabel, opt);
 
670
}
 
671
 
 
672
void ColorButton::onChooseColor()
 
673
{
 
674
    if (!_allowChange)
 
675
        return;
 
676
    QColor c = QColorDialog::getColor( _col, this );
 
677
    if ( c.isValid() )
 
678
    {
 
679
        setColor( c );
 
680
        emit changed();
 
681
    }
 
682
}
 
683
 
 
684
// ------------------------------------------------------------------------------
 
685
 
 
686
PrefColorButton::PrefColorButton ( QWidget * parent )
 
687
  : ColorButton(parent)
 
688
{
 
689
}
 
690
 
 
691
PrefColorButton::~PrefColorButton()
 
692
{
 
693
}
 
694
 
 
695
QByteArray PrefColorButton::entryName () const
 
696
{
 
697
    return m_sPrefName;
 
698
}
 
699
 
 
700
QByteArray PrefColorButton::paramGrpPath () const
 
701
{
 
702
    return m_sPrefGrp;
 
703
}
 
704
 
 
705
void PrefColorButton::setEntryName ( const QByteArray& name )
 
706
{
 
707
    m_sPrefName = name;
 
708
}
 
709
 
 
710
void PrefColorButton::setParamGrpPath ( const QByteArray& name )
 
711
{
 
712
    m_sPrefGrp = name;
 
713
}
 
714
 
 
715
// --------------------------------------------------------------------
 
716
 
 
717
PrefLineEdit::PrefLineEdit ( QWidget * parent )
 
718
  : QLineEdit(parent)
 
719
{
 
720
}
 
721
 
 
722
PrefLineEdit::~PrefLineEdit()
 
723
{
 
724
}
 
725
 
 
726
QByteArray PrefLineEdit::entryName () const
 
727
{
 
728
    return m_sPrefName;
 
729
}
 
730
 
 
731
QByteArray PrefLineEdit::paramGrpPath () const
 
732
{
 
733
    return m_sPrefGrp;
 
734
}
 
735
 
 
736
void PrefLineEdit::setEntryName ( const QByteArray& name )
 
737
{
 
738
    m_sPrefName = name;
 
739
}
 
740
 
 
741
void PrefLineEdit::setParamGrpPath ( const QByteArray& name )
 
742
{
 
743
    m_sPrefGrp = name;
 
744
}
 
745
 
 
746
// --------------------------------------------------------------------
 
747
 
 
748
PrefComboBox::PrefComboBox ( QWidget * parent )
 
749
  : QComboBox(parent)
 
750
{
 
751
    setEditable(false);
 
752
}
 
753
 
 
754
PrefComboBox::~PrefComboBox()
 
755
{
 
756
}
 
757
 
 
758
QByteArray PrefComboBox::entryName () const
 
759
{
 
760
    return m_sPrefName;
 
761
}
 
762
 
 
763
QByteArray PrefComboBox::paramGrpPath () const
 
764
{
 
765
    return m_sPrefGrp;
 
766
}
 
767
 
 
768
void PrefComboBox::setEntryName ( const QByteArray& name )
 
769
{
 
770
    m_sPrefName = name;
 
771
}
 
772
 
 
773
void PrefComboBox::setParamGrpPath ( const QByteArray& name )
 
774
{
 
775
    m_sPrefGrp = name;
 
776
}
 
777
 
 
778
// --------------------------------------------------------------------
 
779
 
 
780
PrefCheckBox::PrefCheckBox ( QWidget * parent )
 
781
  : QCheckBox(parent)
 
782
{
 
783
  setText("CheckBox");
 
784
}
 
785
 
 
786
PrefCheckBox::~PrefCheckBox()
 
787
{
 
788
}
 
789
 
 
790
QByteArray PrefCheckBox::entryName () const
 
791
{
 
792
    return m_sPrefName;
 
793
}
 
794
 
 
795
QByteArray PrefCheckBox::paramGrpPath () const
 
796
{
 
797
    return m_sPrefGrp;
 
798
}
 
799
 
 
800
void PrefCheckBox::setEntryName ( const QByteArray& name )
 
801
{
 
802
    m_sPrefName = name;
 
803
}
 
804
 
 
805
void PrefCheckBox::setParamGrpPath ( const QByteArray& name )
 
806
{
 
807
    m_sPrefGrp = name;
 
808
}
 
809
 
 
810
// --------------------------------------------------------------------
 
811
 
 
812
PrefRadioButton::PrefRadioButton ( QWidget * parent )
 
813
  : QRadioButton(parent)
 
814
{
 
815
    setText("RadioButton");
 
816
}
 
817
 
 
818
PrefRadioButton::~PrefRadioButton()
 
819
{
 
820
}
 
821
 
 
822
QByteArray PrefRadioButton::entryName () const
 
823
{
 
824
    return m_sPrefName;
 
825
}
 
826
 
 
827
QByteArray PrefRadioButton::paramGrpPath () const
 
828
{
 
829
    return m_sPrefGrp;
 
830
}
 
831
 
 
832
void PrefRadioButton::setEntryName ( const QByteArray& name )
 
833
{
 
834
    m_sPrefName = name;
 
835
}
 
836
 
 
837
void PrefRadioButton::setParamGrpPath ( const QByteArray& name )
 
838
{
 
839
    m_sPrefGrp = name;
 
840
}
 
841
 
 
842
// --------------------------------------------------------------------
 
843
 
 
844
PrefSlider::PrefSlider ( QWidget * parent )
 
845
  : QSlider(parent)
 
846
{
 
847
}
 
848
 
 
849
PrefSlider::~PrefSlider()
 
850
{
 
851
}
 
852
 
 
853
QByteArray PrefSlider::entryName () const
 
854
{
 
855
    return m_sPrefName;
 
856
}
 
857
 
 
858
QByteArray PrefSlider::paramGrpPath () const
 
859
{
 
860
    return m_sPrefGrp;
 
861
}
 
862
 
 
863
void PrefSlider::setEntryName ( const QByteArray& name )
 
864
{
 
865
    m_sPrefName = name;
 
866
}
 
867
 
 
868
void PrefSlider::setParamGrpPath ( const QByteArray& name )
 
869
{
 
870
    m_sPrefGrp = name;
 
871
}