mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdeui: drop unused KRuler class
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f4c2f5c84e
commit
d47d67b645
11 changed files with 0 additions and 1155 deletions
|
@ -212,7 +212,6 @@ install(
|
||||||
KReplace
|
KReplace
|
||||||
KReplaceDialog
|
KReplaceDialog
|
||||||
KRestrictedLine
|
KRestrictedLine
|
||||||
KRuler
|
|
||||||
KRun
|
KRun
|
||||||
KSaveFile
|
KSaveFile
|
||||||
KSelectAction
|
KSelectAction
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
#include "../kruler.h"
|
|
|
@ -208,7 +208,6 @@ set(kdeui_LIB_SRCS
|
||||||
widgets/kratingpainter.cpp
|
widgets/kratingpainter.cpp
|
||||||
widgets/kratingwidget.cpp
|
widgets/kratingwidget.cpp
|
||||||
widgets/krestrictedline.cpp
|
widgets/krestrictedline.cpp
|
||||||
widgets/kruler.cpp
|
|
||||||
widgets/kselector.cpp
|
widgets/kselector.cpp
|
||||||
widgets/kseparator.cpp
|
widgets/kseparator.cpp
|
||||||
widgets/kshortcutwidget.cpp
|
widgets/kshortcutwidget.cpp
|
||||||
|
@ -478,7 +477,6 @@ install(
|
||||||
widgets/ktitlewidget.h
|
widgets/ktitlewidget.h
|
||||||
widgets/ktabbar.h
|
widgets/ktabbar.h
|
||||||
widgets/ktabwidget.h
|
widgets/ktabwidget.h
|
||||||
widgets/kruler.h
|
|
||||||
widgets/kselector.h
|
widgets/kselector.h
|
||||||
widgets/kshortcutwidget.h
|
widgets/kshortcutwidget.h
|
||||||
widgets/kstatusbar.h
|
widgets/kstatusbar.h
|
||||||
|
|
|
@ -1,747 +0,0 @@
|
||||||
/* This file is part of the KDE libraries
|
|
||||||
Copyright (C) 1998 Jörg Habenicht (j.habenicht@europemail.com)
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public License
|
|
||||||
along with this library; see the file COPYING.LIB. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "kruler.h"
|
|
||||||
|
|
||||||
#include <QFont>
|
|
||||||
#include <QPolygon>
|
|
||||||
#include <QStylePainter>
|
|
||||||
|
|
||||||
#define INIT_VALUE 0
|
|
||||||
#define INIT_MIN_VALUE 0
|
|
||||||
#define INIT_MAX_VALUE 100
|
|
||||||
#define INIT_TINY_MARK_DISTANCE 1
|
|
||||||
#define INIT_LITTLE_MARK_DISTANCE 5
|
|
||||||
#define INIT_MIDDLE_MARK_DISTANCE (INIT_LITTLE_MARK_DISTANCE * 2)
|
|
||||||
#define INIT_BIG_MARK_DISTANCE (INIT_LITTLE_MARK_DISTANCE * 10)
|
|
||||||
#define INIT_SHOW_TINY_MARK false
|
|
||||||
#define INIT_SHOW_LITTLE_MARK true
|
|
||||||
#define INIT_SHOW_MEDIUM_MARK true
|
|
||||||
#define INIT_SHOW_BIG_MARK true
|
|
||||||
#define INIT_SHOW_END_MARK true
|
|
||||||
#define INIT_SHOW_POINTER true
|
|
||||||
#define INIT_SHOW_END_LABEL true
|
|
||||||
|
|
||||||
#define INIT_PIXEL_PER_MARK (double)10.0 /* distance between 2 base marks in pixel */
|
|
||||||
#define INIT_OFFSET (-20)
|
|
||||||
#define INIT_LENGTH_FIX true
|
|
||||||
#define INIT_END_OFFSET 0
|
|
||||||
|
|
||||||
#define FIX_WIDTH 20 /* widget width in pixel */
|
|
||||||
#define LINE_END (FIX_WIDTH - 3)
|
|
||||||
#define END_MARK_LENGTH (FIX_WIDTH - 6)
|
|
||||||
#define END_MARK_X2 LINE_END
|
|
||||||
#define END_MARK_X1 (END_MARK_X2 - END_MARK_LENGTH)
|
|
||||||
#define BIG_MARK_LENGTH (END_MARK_LENGTH*3/4)
|
|
||||||
#define BIG_MARK_X2 LINE_END
|
|
||||||
#define BIG_MARK_X1 (BIG_MARK_X2 - BIG_MARK_LENGTH)
|
|
||||||
#define MIDDLE_MARK_LENGTH (END_MARK_LENGTH/2)
|
|
||||||
#define MIDDLE_MARK_X2 LINE_END
|
|
||||||
#define MIDDLE_MARK_X1 (MIDDLE_MARK_X2 - MIDDLE_MARK_LENGTH)
|
|
||||||
#define LITTLE_MARK_LENGTH (MIDDLE_MARK_LENGTH/2)
|
|
||||||
#define LITTLE_MARK_X2 LINE_END
|
|
||||||
#define LITTLE_MARK_X1 (LITTLE_MARK_X2 - LITTLE_MARK_LENGTH)
|
|
||||||
#define BASE_MARK_LENGTH (LITTLE_MARK_LENGTH/2)
|
|
||||||
#define BASE_MARK_X2 LINE_END
|
|
||||||
#define BASE_MARK_X1 (BASE_MARK_X2 - BASE_MARK_LENGTH)
|
|
||||||
|
|
||||||
#define LABEL_SIZE 8
|
|
||||||
#define END_LABEL_X 4
|
|
||||||
#define END_LABEL_Y (END_LABEL_X + LABEL_SIZE - 2)
|
|
||||||
|
|
||||||
#undef PROFILING
|
|
||||||
|
|
||||||
#ifdef PROFILING
|
|
||||||
# include <qdatetime.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class KRuler::KRulerPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
int endOffset_length; /* marks the offset at the end of the ruler
|
|
||||||
* i.e. right side at horizontal and down side
|
|
||||||
* at vertical rulers.
|
|
||||||
* the ruler end mark is moved endOffset_length
|
|
||||||
* ticks away from the widget end.
|
|
||||||
* positive offset moves end mark inside the ruler.
|
|
||||||
* if lengthFix is true, endOffset_length holds the
|
|
||||||
* length of the ruler.
|
|
||||||
*/
|
|
||||||
int fontWidth; // ONLY valid for vertical rulers
|
|
||||||
|
|
||||||
QAbstractSlider range;
|
|
||||||
Qt::Orientation dir;
|
|
||||||
int tmDist;
|
|
||||||
int lmDist;
|
|
||||||
int mmDist;
|
|
||||||
int bmDist;
|
|
||||||
int offset;
|
|
||||||
bool showtm : 1; /* show tiny, little, medium, big, endmarks */
|
|
||||||
bool showlm : 1;
|
|
||||||
bool showmm : 1;
|
|
||||||
bool showbm : 1;
|
|
||||||
bool showem : 1;
|
|
||||||
|
|
||||||
bool showpointer : 1;
|
|
||||||
bool showEndL : 1;
|
|
||||||
bool lengthFix : 1;
|
|
||||||
|
|
||||||
double ppm; /* pixel per mark */
|
|
||||||
|
|
||||||
QString endlabel;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
KRuler::KRuler(QWidget *parent)
|
|
||||||
: QAbstractSlider(parent)
|
|
||||||
, d( new KRulerPrivate )
|
|
||||||
{
|
|
||||||
setRange(INIT_MIN_VALUE, INIT_MAX_VALUE);
|
|
||||||
setPageStep(10);
|
|
||||||
setValue(INIT_VALUE);
|
|
||||||
init(Qt::Horizontal);
|
|
||||||
setFixedHeight(FIX_WIDTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
KRuler::KRuler(Qt::Orientation orient,
|
|
||||||
QWidget *parent, Qt::WindowFlags f)
|
|
||||||
: QAbstractSlider(parent)
|
|
||||||
, d( new KRulerPrivate )
|
|
||||||
{
|
|
||||||
setRange(INIT_MIN_VALUE, INIT_MAX_VALUE);
|
|
||||||
setPageStep(10);
|
|
||||||
setValue(INIT_VALUE);
|
|
||||||
setWindowFlags(f);
|
|
||||||
init(orient);
|
|
||||||
if (orient == Qt::Horizontal)
|
|
||||||
setFixedHeight(FIX_WIDTH);
|
|
||||||
else
|
|
||||||
setFixedWidth(FIX_WIDTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
KRuler::KRuler(Qt::Orientation orient, int widgetWidth,
|
|
||||||
QWidget *parent, Qt::WindowFlags f)
|
|
||||||
: QAbstractSlider(parent)
|
|
||||||
, d( new KRulerPrivate )
|
|
||||||
{
|
|
||||||
setRange(INIT_MIN_VALUE, INIT_MAX_VALUE);
|
|
||||||
setPageStep(10);
|
|
||||||
setValue(INIT_VALUE);
|
|
||||||
setWindowFlags(f);
|
|
||||||
init(orient);
|
|
||||||
if (orient == Qt::Horizontal)
|
|
||||||
setFixedHeight(widgetWidth);
|
|
||||||
else
|
|
||||||
setFixedWidth(widgetWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KRuler::init(Qt::Orientation orientation)
|
|
||||||
{
|
|
||||||
#warning FIXME setFrameStyle(WinPanel | Raised);
|
|
||||||
|
|
||||||
d->showpointer = INIT_SHOW_POINTER;
|
|
||||||
d->showEndL = INIT_SHOW_END_LABEL;
|
|
||||||
d->lengthFix = INIT_LENGTH_FIX;
|
|
||||||
d->endOffset_length = INIT_END_OFFSET;
|
|
||||||
|
|
||||||
d->tmDist = INIT_TINY_MARK_DISTANCE;
|
|
||||||
d->lmDist = INIT_LITTLE_MARK_DISTANCE;
|
|
||||||
d->mmDist = INIT_MIDDLE_MARK_DISTANCE;
|
|
||||||
d->bmDist = INIT_BIG_MARK_DISTANCE;
|
|
||||||
d->offset= INIT_OFFSET;
|
|
||||||
d->showtm = INIT_SHOW_TINY_MARK;
|
|
||||||
d->showlm = INIT_SHOW_LITTLE_MARK;
|
|
||||||
d->showmm = INIT_SHOW_MEDIUM_MARK;
|
|
||||||
d->showbm = INIT_SHOW_BIG_MARK;
|
|
||||||
d->showem = INIT_SHOW_END_MARK;
|
|
||||||
d->ppm = INIT_PIXEL_PER_MARK;
|
|
||||||
d->dir = orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
KRuler::~KRuler()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setTinyMarkDistance(int dist)
|
|
||||||
{
|
|
||||||
if (dist != d->tmDist) {
|
|
||||||
d->tmDist = dist;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
KRuler::tinyMarkDistance() const
|
|
||||||
{ return d->tmDist; }
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setLittleMarkDistance(int dist)
|
|
||||||
{
|
|
||||||
if (dist != d->lmDist) {
|
|
||||||
d->lmDist = dist;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
KRuler::littleMarkDistance() const
|
|
||||||
{ return d->lmDist; }
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setMediumMarkDistance(int dist)
|
|
||||||
{
|
|
||||||
if (dist != d->mmDist) {
|
|
||||||
d->mmDist = dist;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
KRuler::mediumMarkDistance() const
|
|
||||||
{ return d->mmDist; }
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setBigMarkDistance(int dist)
|
|
||||||
{
|
|
||||||
if (dist != d->bmDist) {
|
|
||||||
d->bmDist = dist;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
KRuler::bigMarkDistance() const
|
|
||||||
{ return d->bmDist; }
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setShowTinyMarks(bool show)
|
|
||||||
{
|
|
||||||
if (show != d->showtm) {
|
|
||||||
d->showtm = show;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
KRuler::showTinyMarks() const
|
|
||||||
{
|
|
||||||
return d->showtm;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setShowLittleMarks(bool show)
|
|
||||||
{
|
|
||||||
if (show != d->showlm) {
|
|
||||||
d->showlm = show;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
KRuler::showLittleMarks() const
|
|
||||||
{
|
|
||||||
return d->showlm;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setShowMediumMarks(bool show)
|
|
||||||
{
|
|
||||||
if (show != d->showmm) {
|
|
||||||
d->showmm = show;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
KRuler::showMediumMarks() const
|
|
||||||
{
|
|
||||||
return d->showmm;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setShowBigMarks(bool show)
|
|
||||||
{
|
|
||||||
if (show != d->showbm) {
|
|
||||||
d->showbm = show;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
KRuler::showBigMarks() const
|
|
||||||
{
|
|
||||||
return d->showbm;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setShowEndMarks(bool show)
|
|
||||||
{
|
|
||||||
if (show != d->showem) {
|
|
||||||
d->showem = show;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
KRuler::showEndMarks() const
|
|
||||||
{
|
|
||||||
return d->showem;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setShowPointer(bool show)
|
|
||||||
{
|
|
||||||
if (show != d->showpointer) {
|
|
||||||
d->showpointer = show;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
KRuler::showPointer() const
|
|
||||||
{
|
|
||||||
return d->showpointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setFrameStyle(int)
|
|
||||||
{
|
|
||||||
#warning implement me (jowenn)
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setShowEndLabel(bool show)
|
|
||||||
{
|
|
||||||
if (d->showEndL != show) {
|
|
||||||
d->showEndL = show;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
KRuler::showEndLabel() const
|
|
||||||
{
|
|
||||||
return d->showEndL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setEndLabel(const QString& label)
|
|
||||||
{
|
|
||||||
d->endlabel = label;
|
|
||||||
|
|
||||||
// premeasure the fontwidth and save it
|
|
||||||
if (d->dir == Qt::Vertical) {
|
|
||||||
QFont font = this->font();
|
|
||||||
font.setPointSize(LABEL_SIZE);
|
|
||||||
QFontMetrics fm(font);
|
|
||||||
d->fontWidth = fm.width(d->endlabel);
|
|
||||||
}
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KRuler::endLabel() const
|
|
||||||
{
|
|
||||||
return d->endlabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setRulerMetricStyle(KRuler::MetricStyle style)
|
|
||||||
{
|
|
||||||
switch (style) {
|
|
||||||
default: /* fall through */
|
|
||||||
case Custom:
|
|
||||||
return;
|
|
||||||
case Pixel:
|
|
||||||
setLittleMarkDistance(1);
|
|
||||||
setMediumMarkDistance(5);
|
|
||||||
setBigMarkDistance(10);
|
|
||||||
|
|
||||||
setShowTinyMarks(false);
|
|
||||||
setShowLittleMarks(true);
|
|
||||||
setShowMediumMarks(true);
|
|
||||||
setShowBigMarks(true);
|
|
||||||
setShowEndMarks(true);
|
|
||||||
|
|
||||||
update(contentsRect());
|
|
||||||
setPixelPerMark(10.0);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case Inch:
|
|
||||||
setTinyMarkDistance(1);
|
|
||||||
setLittleMarkDistance(2);
|
|
||||||
setMediumMarkDistance(4);
|
|
||||||
setBigMarkDistance(8);
|
|
||||||
|
|
||||||
setShowTinyMarks(true);
|
|
||||||
setShowLittleMarks(true);
|
|
||||||
setShowMediumMarks(true);
|
|
||||||
setShowBigMarks(true);
|
|
||||||
setShowEndMarks(true);
|
|
||||||
|
|
||||||
update(contentsRect());
|
|
||||||
setPixelPerMark(9.0);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case Millimetres: /* fall through */
|
|
||||||
case Centimetres: /* fall through */
|
|
||||||
case Metres:
|
|
||||||
setLittleMarkDistance(1);
|
|
||||||
setMediumMarkDistance(5);
|
|
||||||
setBigMarkDistance(10);
|
|
||||||
|
|
||||||
setShowTinyMarks(false);
|
|
||||||
setShowLittleMarks(true);
|
|
||||||
setShowMediumMarks(true);
|
|
||||||
setShowBigMarks(true);
|
|
||||||
setShowEndMarks(true);
|
|
||||||
|
|
||||||
update(contentsRect());
|
|
||||||
setPixelPerMark(3.0);
|
|
||||||
}
|
|
||||||
switch (style) {
|
|
||||||
case Pixel:
|
|
||||||
setEndLabel(QLatin1String("pixel"));
|
|
||||||
break;
|
|
||||||
case Inch:
|
|
||||||
setEndLabel(QLatin1String("inch"));
|
|
||||||
break;
|
|
||||||
case Millimetres:
|
|
||||||
setEndLabel(QLatin1String("mm"));
|
|
||||||
break;
|
|
||||||
case Centimetres:
|
|
||||||
setEndLabel(QLatin1String("cm"));
|
|
||||||
break;
|
|
||||||
case Metres:
|
|
||||||
setEndLabel(QLatin1String("m"));
|
|
||||||
default: /* never reached, see above switch */
|
|
||||||
/* empty command */;
|
|
||||||
}
|
|
||||||
// if the style changes one of the values,
|
|
||||||
// update would have been called inside the methods
|
|
||||||
// -> no update() call needed here !
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setPixelPerMark(double rate)
|
|
||||||
{ // never compare floats against each other :)
|
|
||||||
d->ppm = rate;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
KRuler::pixelPerMark() const
|
|
||||||
{ return d->ppm; }
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setLength(int length)
|
|
||||||
{
|
|
||||||
int tmp;
|
|
||||||
if (d->lengthFix) {
|
|
||||||
tmp = length;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tmp = width() - length;
|
|
||||||
}
|
|
||||||
if (tmp != d->endOffset_length) {
|
|
||||||
d->endOffset_length = tmp;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
KRuler::length() const
|
|
||||||
{
|
|
||||||
if (d->lengthFix) {
|
|
||||||
return d->endOffset_length;
|
|
||||||
}
|
|
||||||
return (width() - d->endOffset_length);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setLengthFixed(bool fix)
|
|
||||||
{
|
|
||||||
d->lengthFix = fix;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
KRuler::lengthFixed() const
|
|
||||||
{
|
|
||||||
return d->lengthFix;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::setOffset(int _offset)
|
|
||||||
{// debug("set offset %i", _offset);
|
|
||||||
if (d->offset != _offset) {
|
|
||||||
d->offset = _offset;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
KRuler::offset() const
|
|
||||||
{ return d->offset; }
|
|
||||||
|
|
||||||
int
|
|
||||||
KRuler::endOffset() const
|
|
||||||
{
|
|
||||||
if (d->lengthFix) {
|
|
||||||
return (width() - d->endOffset_length);
|
|
||||||
}
|
|
||||||
return d->endOffset_length;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::slideUp(int count)
|
|
||||||
{
|
|
||||||
if (count) {
|
|
||||||
d->offset += count;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::slideDown(int count)
|
|
||||||
{
|
|
||||||
if (count) {
|
|
||||||
d->offset -= count;
|
|
||||||
update(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::slotNewValue(int _value)
|
|
||||||
{
|
|
||||||
int oldvalue = value();
|
|
||||||
if (oldvalue == _value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// setValue(_value);
|
|
||||||
setValue(_value);
|
|
||||||
if (value() == oldvalue) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// get the rectangular of the old and the new ruler pointer
|
|
||||||
// and repaint only him
|
|
||||||
if (d->dir == Qt::Horizontal) {
|
|
||||||
QRect oldrec(-5+oldvalue,10, 11,6);
|
|
||||||
QRect newrec(-5+_value,10, 11,6);
|
|
||||||
repaint( oldrec.united(newrec) );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
QRect oldrec(10,-5+oldvalue, 6,11);
|
|
||||||
QRect newrec(10,-5+_value, 6,11);
|
|
||||||
repaint( oldrec.united(newrec) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::slotNewOffset(int _offset)
|
|
||||||
{
|
|
||||||
if (d->offset != _offset) {
|
|
||||||
//setOffset(_offset);
|
|
||||||
d->offset = _offset;
|
|
||||||
repaint(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::slotEndOffset(int offset)
|
|
||||||
{
|
|
||||||
int tmp;
|
|
||||||
if (d->lengthFix) {
|
|
||||||
tmp = width() - offset;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tmp = offset;
|
|
||||||
}
|
|
||||||
if (d->endOffset_length != tmp) {
|
|
||||||
d->endOffset_length = tmp;
|
|
||||||
repaint(contentsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KRuler::paintEvent(QPaintEvent * /*e*/)
|
|
||||||
{
|
|
||||||
// debug ("KRuler::drawContents, %s",(horizontal==dir)?"horizontal":"vertical");
|
|
||||||
|
|
||||||
QStylePainter p(this);
|
|
||||||
#ifdef PROFILING
|
|
||||||
QTime time;
|
|
||||||
time.start();
|
|
||||||
for (int profile=0; profile<10; profile++) {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int value = this->value(),
|
|
||||||
minval = minimum(),
|
|
||||||
maxval;
|
|
||||||
if (d->dir == Qt::Horizontal) {
|
|
||||||
maxval = maximum()
|
|
||||||
+ d->offset
|
|
||||||
- (d->lengthFix?(height()-d->endOffset_length):d->endOffset_length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxval = maximum()
|
|
||||||
+ d->offset
|
|
||||||
- (d->lengthFix?(width()-d->endOffset_length):d->endOffset_length);
|
|
||||||
}
|
|
||||||
//ioffsetval = value-offset;
|
|
||||||
// pixelpm = (int)ppm;
|
|
||||||
// left = clip.left(),
|
|
||||||
// right = clip.right();
|
|
||||||
double f, fend,
|
|
||||||
offsetmin=(double)(minval-d->offset),
|
|
||||||
offsetmax=(double)(maxval-d->offset),
|
|
||||||
fontOffset = (((double)minval)>offsetmin)?(double)minval:offsetmin;
|
|
||||||
|
|
||||||
// draw labels
|
|
||||||
QFont font = p.font();
|
|
||||||
font.setPointSize(LABEL_SIZE);
|
|
||||||
p.setFont( font );
|
|
||||||
// draw littlemarklabel
|
|
||||||
|
|
||||||
// draw mediummarklabel
|
|
||||||
|
|
||||||
// draw bigmarklabel
|
|
||||||
|
|
||||||
// draw endlabel
|
|
||||||
if (d->showEndL) {
|
|
||||||
if (d->dir == Qt::Horizontal) {
|
|
||||||
p.translate( fontOffset, 0 );
|
|
||||||
p.drawText( END_LABEL_X, END_LABEL_Y, d->endlabel );
|
|
||||||
}
|
|
||||||
else { // rotate text +pi/2 and move down a bit
|
|
||||||
//QFontMetrics fm(font);
|
|
||||||
#ifdef KRULER_ROTATE_TEST
|
|
||||||
p.rotate( -90.0 + rotate );
|
|
||||||
p.translate( -8.0 - fontOffset - d->fontWidth + xtrans,
|
|
||||||
ytrans );
|
|
||||||
#else
|
|
||||||
p.rotate( -90.0 );
|
|
||||||
p.translate( -8.0 - fontOffset - d->fontWidth, 0.0 );
|
|
||||||
#endif
|
|
||||||
p.drawText( END_LABEL_X, END_LABEL_Y, d->endlabel );
|
|
||||||
}
|
|
||||||
p.resetMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw the tiny marks
|
|
||||||
if (d->showtm) {
|
|
||||||
fend = d->ppm*d->tmDist;
|
|
||||||
for ( f=offsetmin; f<offsetmax; f+=fend ) {
|
|
||||||
if (d->dir == Qt::Horizontal) {
|
|
||||||
p.drawLine((int)f, BASE_MARK_X1, (int)f, BASE_MARK_X2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p.drawLine(BASE_MARK_X1, (int)f, BASE_MARK_X2, (int)f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (d->showlm) {
|
|
||||||
// draw the little marks
|
|
||||||
fend = d->ppm*d->lmDist;
|
|
||||||
for ( f=offsetmin; f<offsetmax; f+=fend ) {
|
|
||||||
if (d->dir == Qt::Horizontal) {
|
|
||||||
p.drawLine((int)f, LITTLE_MARK_X1, (int)f, LITTLE_MARK_X2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p.drawLine(LITTLE_MARK_X1, (int)f, LITTLE_MARK_X2, (int)f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (d->showmm) {
|
|
||||||
// draw medium marks
|
|
||||||
fend = d->ppm*d->mmDist;
|
|
||||||
for ( f=offsetmin; f<offsetmax; f+=fend ) {
|
|
||||||
if (d->dir == Qt::Horizontal) {
|
|
||||||
p.drawLine((int)f, MIDDLE_MARK_X1, (int)f, MIDDLE_MARK_X2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p.drawLine(MIDDLE_MARK_X1, (int)f, MIDDLE_MARK_X2, (int)f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (d->showbm) {
|
|
||||||
// draw big marks
|
|
||||||
fend = d->ppm*d->bmDist;
|
|
||||||
for ( f=offsetmin; f<offsetmax; f+=fend ) {
|
|
||||||
if (d->dir == Qt::Horizontal) {
|
|
||||||
p.drawLine((int)f, BIG_MARK_X1, (int)f, BIG_MARK_X2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p.drawLine(BIG_MARK_X1, (int)f, BIG_MARK_X2, (int)f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (d->showem) {
|
|
||||||
// draw end marks
|
|
||||||
if (d->dir == Qt::Horizontal) {
|
|
||||||
p.drawLine(minval-d->offset, END_MARK_X1, minval-d->offset, END_MARK_X2);
|
|
||||||
p.drawLine(maxval-d->offset, END_MARK_X1, maxval-d->offset, END_MARK_X2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p.drawLine(END_MARK_X1, minval-d->offset, END_MARK_X2, minval-d->offset);
|
|
||||||
p.drawLine(END_MARK_X1, maxval-d->offset, END_MARK_X2, maxval-d->offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw pointer
|
|
||||||
if (d->showpointer) {
|
|
||||||
QPolygon pa(4);
|
|
||||||
if (d->dir == Qt::Horizontal) {
|
|
||||||
pa.setPoints(3, value-5, 10, value+5, 10, value/*+0*/,15);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pa.setPoints(3, 10, value-5, 10, value+5, 15, value/*+0*/);
|
|
||||||
}
|
|
||||||
p.setBrush( p.background().color() );
|
|
||||||
p.drawPolygon( pa );
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PROFILING
|
|
||||||
}
|
|
||||||
int elapsed = time.elapsed();
|
|
||||||
debug("paint time %i",elapsed);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_kruler.cpp"
|
|
|
@ -1,395 +0,0 @@
|
||||||
/* -*- c++ -*- */
|
|
||||||
/* This file is part of the KDE libraries
|
|
||||||
Copyright (C) 1998 Jörg Habenicht (j.habenicht@europemail.com)
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public License
|
|
||||||
along with this library; see the file COPYING.LIB. If not, write to
|
|
||||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef KRULER_H
|
|
||||||
#define KRULER_H
|
|
||||||
|
|
||||||
#include <kdeui_export.h>
|
|
||||||
|
|
||||||
#include <QtGui/QAbstractSlider>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A ruler widget.
|
|
||||||
*
|
|
||||||
* The vertical ruler looks similar to this:
|
|
||||||
*
|
|
||||||
*\code
|
|
||||||
* meters inches
|
|
||||||
*
|
|
||||||
* ------ <--- end mark ---> ------
|
|
||||||
* -- -
|
|
||||||
* -- <---little mark---> --
|
|
||||||
* -- -
|
|
||||||
* -- ---
|
|
||||||
* --- <---medium mark -
|
|
||||||
* -- --
|
|
||||||
* -- tiny mark----> -
|
|
||||||
* -- ----
|
|
||||||
* -- -
|
|
||||||
* ---- <-----big mark --
|
|
||||||
* -- -
|
|
||||||
* |>-- <--ruler pointer--> |>--
|
|
||||||
*
|
|
||||||
* \endcode
|
|
||||||
*
|
|
||||||
* There are tiny marks, little marks, medium marks, and big marks along the
|
|
||||||
* ruler.
|
|
||||||
*
|
|
||||||
* To receive mouse clicks or mouse moves,
|
|
||||||
* the class has to be overloaded.
|
|
||||||
*
|
|
||||||
* For performance reasons, the public methods don't call QWidget::repaint().
|
|
||||||
* (Slots do, see documentation below.)
|
|
||||||
* All the changed settings will be painted once after leaving
|
|
||||||
* to the main event loop.
|
|
||||||
* For performance painting the slot methods should be used,
|
|
||||||
* they do a fast QWidget::repaint() call after changing the values.
|
|
||||||
* For setting multiple values like minValue(), maxValue(), offset() etc.
|
|
||||||
* using the public methods is recommended
|
|
||||||
* so the widget will be painted only once when entering the main event loop.
|
|
||||||
*
|
|
||||||
* \image html kruler.png "KDE Ruler Widget"
|
|
||||||
*
|
|
||||||
* @short A ruler widget.
|
|
||||||
* @author Jörg Habenicht
|
|
||||||
*/
|
|
||||||
class KDEUI_EXPORT KRuler : public QAbstractSlider
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY( bool showTinyMarks READ showTinyMarks WRITE setShowTinyMarks )
|
|
||||||
Q_PROPERTY( bool showLittleMarks READ showLittleMarks WRITE setShowLittleMarks )
|
|
||||||
Q_PROPERTY( bool showMediumMarks READ showMediumMarks WRITE setShowMediumMarks )
|
|
||||||
Q_PROPERTY( bool showBigMarks READ showBigMarks WRITE setShowBigMarks )
|
|
||||||
Q_PROPERTY( bool showPointer READ showPointer WRITE setShowPointer )
|
|
||||||
Q_PROPERTY( bool showEndLabel READ showEndLabel WRITE setShowEndLabel )
|
|
||||||
Q_PROPERTY( int tinyMarkDistance READ tinyMarkDistance WRITE setTinyMarkDistance )
|
|
||||||
Q_PROPERTY( int littleMarkDistance READ littleMarkDistance WRITE setLittleMarkDistance )
|
|
||||||
Q_PROPERTY( int mediumMarkDistance READ mediumMarkDistance WRITE setBigMarkDistance )
|
|
||||||
Q_PROPERTY( int bigMarkDistance READ bigMarkDistance WRITE setBigMarkDistance )
|
|
||||||
Q_PROPERTY( double pixelPerMark READ pixelPerMark WRITE setPixelPerMark )
|
|
||||||
Q_PROPERTY( bool lengthFixed READ lengthFixed WRITE setLengthFixed )
|
|
||||||
Q_PROPERTY( QString endLabel READ endLabel WRITE setEndLabel )
|
|
||||||
Q_ENUMS( MetricStyle )
|
|
||||||
Q_PROPERTY( int length READ length WRITE setLength )
|
|
||||||
Q_PROPERTY( int offset READ offset )
|
|
||||||
Q_PROPERTY( int endOffset READ endOffset )
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define KRULER_ROTATE_TEST KRULER_ROTATE_TEST
|
|
||||||
#undef KRULER_ROTATE_TEST
|
|
||||||
#ifdef KRULER_ROTATE_TEST
|
|
||||||
double xtrans, ytrans, rotate;
|
|
||||||
# warning tmporaer variablen eingeschaltet
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The types of units used.
|
|
||||||
**/
|
|
||||||
enum MetricStyle { Custom=0, Pixel, Inch, Millimetres, Centimetres, Metres };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The style (or look) of the ruler.
|
|
||||||
**/
|
|
||||||
// enum PaintStyle { Flat, Raised, Sunken };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a horizontal ruler.
|
|
||||||
*/
|
|
||||||
explicit KRuler(QWidget *parent=0);
|
|
||||||
/**
|
|
||||||
* Constructs a ruler with orientation @p orient.
|
|
||||||
*
|
|
||||||
* @p parent and @p f are passed to QFrame.
|
|
||||||
* The default look is a raised widget
|
|
||||||
* but may be changed with the inherited QFrame methods.
|
|
||||||
*
|
|
||||||
* @param orient Orientation of the ruler.
|
|
||||||
* @param parent Will be handed over to QFrame.
|
|
||||||
* @param f Will be handed over to QFrame.
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
explicit KRuler(Qt::Orientation orient, QWidget *parent=0, Qt::WindowFlags f=0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a ruler with orientation @p orient and initial width @p widgetWidth.
|
|
||||||
*
|
|
||||||
* The width sets the fixed width of the widget. This is useful if you
|
|
||||||
* want to draw the ruler bigger or smaller than the default size.
|
|
||||||
* Note: The size of the marks doesn't change.
|
|
||||||
* @p parent and @p f are passed to QFrame.
|
|
||||||
*
|
|
||||||
* @param orient Orientation of the ruler.
|
|
||||||
* @param widgetWidth Fixed width of the widget.
|
|
||||||
* @param parent Will be handed over to QFrame.
|
|
||||||
* @param f Will be handed over to QFrame.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
KRuler(Qt::Orientation orient, int widgetWidth, QWidget *parent=0,
|
|
||||||
Qt::WindowFlags f=0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor.
|
|
||||||
*/
|
|
||||||
~KRuler();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the distance between tiny marks.
|
|
||||||
*
|
|
||||||
* This is mostly used in the English system (inches) with distance of 1.
|
|
||||||
*/
|
|
||||||
void setTinyMarkDistance(int);
|
|
||||||
/**
|
|
||||||
* Returns the distance between tiny marks.
|
|
||||||
**/
|
|
||||||
int tinyMarkDistance() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the distance between little marks.
|
|
||||||
*
|
|
||||||
* The default value is 1 in the metric system and 2 in the English (inches) system.
|
|
||||||
*/
|
|
||||||
void setLittleMarkDistance(int);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the distance between little marks.
|
|
||||||
*/
|
|
||||||
int littleMarkDistance() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the distance between medium marks.
|
|
||||||
*
|
|
||||||
* For English (inches) styles it defaults to twice the little mark distance.
|
|
||||||
* For metric styles it defaults to five times the little mark distance.
|
|
||||||
**/
|
|
||||||
void setMediumMarkDistance(int);
|
|
||||||
int mediumMarkDistance() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets distance between big marks.
|
|
||||||
*
|
|
||||||
* For English (inches) or metric styles it is twice the medium mark distance.
|
|
||||||
**/
|
|
||||||
void setBigMarkDistance(int);
|
|
||||||
/**
|
|
||||||
* Returns the distance between big marks.
|
|
||||||
**/
|
|
||||||
int bigMarkDistance() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows/hides tiny marks.
|
|
||||||
**/
|
|
||||||
void setShowTinyMarks(bool);
|
|
||||||
bool showTinyMarks() const;
|
|
||||||
/**
|
|
||||||
* Shows/hides little marks.
|
|
||||||
**/
|
|
||||||
void setShowLittleMarks(bool);
|
|
||||||
bool showLittleMarks() const;
|
|
||||||
/**
|
|
||||||
* Shows/hides medium marks.
|
|
||||||
**/
|
|
||||||
void setShowMediumMarks(bool);
|
|
||||||
bool showMediumMarks() const;
|
|
||||||
/**
|
|
||||||
* Shows/hides big marks.
|
|
||||||
**/
|
|
||||||
void setShowBigMarks(bool);
|
|
||||||
bool showBigMarks() const;
|
|
||||||
/**
|
|
||||||
* Shows/hides end marks.
|
|
||||||
**/
|
|
||||||
void setShowEndMarks(bool);
|
|
||||||
bool showEndMarks() const;
|
|
||||||
/**
|
|
||||||
* Shows/hides the pointer.
|
|
||||||
*/
|
|
||||||
void setShowPointer(bool);
|
|
||||||
bool showPointer() const;
|
|
||||||
|
|
||||||
|
|
||||||
void setFrameStyle(int);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show/hide number values of the little marks.
|
|
||||||
*
|
|
||||||
* Default is @p false.
|
|
||||||
**/
|
|
||||||
// void setShowLittleMarkLabel(bool);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show/hide number values of the medium marks.
|
|
||||||
*
|
|
||||||
* Default is @p false.
|
|
||||||
**/
|
|
||||||
// void setShowMediumMarkLabel(bool);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show/hide number values of the big marks.
|
|
||||||
*
|
|
||||||
* Default is @p false.
|
|
||||||
**/
|
|
||||||
// void showBigMarkLabel(bool);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show/hide number values of the end marks.
|
|
||||||
*
|
|
||||||
* Default is @p false.
|
|
||||||
**/
|
|
||||||
void setShowEndLabel(bool);
|
|
||||||
bool showEndLabel() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the label this is drawn at the beginning of the visible part
|
|
||||||
* of the ruler to @p label
|
|
||||||
**/
|
|
||||||
void setEndLabel(const QString&);
|
|
||||||
QString endLabel() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets up the necessary tasks for the provided styles.
|
|
||||||
*
|
|
||||||
* A convenience method.
|
|
||||||
**/
|
|
||||||
void setRulerMetricStyle(KRuler::MetricStyle);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the number of pixels between two base marks.
|
|
||||||
*
|
|
||||||
* Calling this method stretches or shrinks your ruler.
|
|
||||||
*
|
|
||||||
* For pixel display ( MetricStyle) the value is 10.0 marks
|
|
||||||
* per pixel ;-)
|
|
||||||
* For English (inches) it is 9.0, and for centimetres ~2.835 -> 3.0 .
|
|
||||||
* If you want to magnify your part of display, you have to
|
|
||||||
* adjust the mark distance @p here.
|
|
||||||
* Notice: The double type is only supported to give the possibility
|
|
||||||
* of having some double values.
|
|
||||||
* It should be used with care. Using values below 10.0
|
|
||||||
* shows visible jumps of markpositions (e.g. 2.345).
|
|
||||||
* Using whole numbers is highly recommended.
|
|
||||||
* To use @p int values use setPixelPerMark((int)your_int_value);
|
|
||||||
* default: 1 mark per 10 pixels
|
|
||||||
*/
|
|
||||||
void setPixelPerMark(double rate);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of pixels between two base marks.
|
|
||||||
**/
|
|
||||||
double pixelPerMark() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the length of the ruler, i.e. the difference between
|
|
||||||
* the begin mark and the end mark of the ruler.
|
|
||||||
*
|
|
||||||
* Same as (width() - offset())
|
|
||||||
*
|
|
||||||
* when the length is not locked, it gets adjusted with the
|
|
||||||
* length of the widget.
|
|
||||||
*/
|
|
||||||
void setLength(int);
|
|
||||||
int length() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Locks the length of the ruler, i.e. the difference between
|
|
||||||
* the two end marks doesn't change when the widget is resized.
|
|
||||||
*
|
|
||||||
* @param fix fixes the length, if true
|
|
||||||
*/
|
|
||||||
void setLengthFixed(bool fix);
|
|
||||||
bool lengthFixed() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the number of pixels by which the ruler may slide up or left.
|
|
||||||
* The number of pixels moved is realive to the previous position.
|
|
||||||
* The Method makes sense for updating a ruler, which is working with
|
|
||||||
* a scrollbar.
|
|
||||||
*
|
|
||||||
* This doesn't affect the position of the ruler pointer.
|
|
||||||
* Only the visible part of the ruler is moved.
|
|
||||||
*
|
|
||||||
* @param count Number of pixel moving up or left relative to the previous position
|
|
||||||
**/
|
|
||||||
void slideUp(int count = 1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the number of pixels by which the ruler may slide down or right.
|
|
||||||
* The number of pixels moved is realive to the previous position.
|
|
||||||
* The Method makes sense for updating a ruler, which is working with
|
|
||||||
* a scrollbar.
|
|
||||||
*
|
|
||||||
* This doesn't affect the position of the ruler pointer.
|
|
||||||
* Only the visible part of the ruler is moved.
|
|
||||||
*
|
|
||||||
* @param count Number of pixel moving up or left relative to the previous position
|
|
||||||
**/
|
|
||||||
void slideDown(int count = 1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the ruler slide offset.
|
|
||||||
*
|
|
||||||
* This is like slideup() or slidedown() with an absolute offset
|
|
||||||
* from the start of the ruler.
|
|
||||||
*
|
|
||||||
* @param offset Number of pixel to move the ruler up or left from the beginning
|
|
||||||
**/
|
|
||||||
void setOffset(int offset);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current ruler offset.
|
|
||||||
**/
|
|
||||||
int offset() const;
|
|
||||||
|
|
||||||
int endOffset() const;
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the pointer to a new position.
|
|
||||||
*
|
|
||||||
* The offset is NOT updated.
|
|
||||||
* QWidget::repaint() is called afterwards.
|
|
||||||
**/
|
|
||||||
void slotNewValue(int);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the ruler marks to a new position.
|
|
||||||
*
|
|
||||||
* The pointer is NOT updated.
|
|
||||||
* QWidget::repaint() is called afterwards.
|
|
||||||
**/
|
|
||||||
void slotNewOffset(int);
|
|
||||||
|
|
||||||
void slotEndOffset(int);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void paintEvent(QPaintEvent *);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void init(Qt::Orientation orientation);
|
|
||||||
|
|
||||||
private:
|
|
||||||
class KRulerPrivate;
|
|
||||||
KRulerPrivate * const d;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -187,11 +187,6 @@ Group=Display (KDE)
|
||||||
ToolTip=Line Edit for restricted input (KDE)
|
ToolTip=Line Edit for restricted input (KDE)
|
||||||
Group=Input (KDE)
|
Group=Input (KDE)
|
||||||
|
|
||||||
[KRuler]
|
|
||||||
ToolTip=Measuring Ruler Widget (KDE)
|
|
||||||
WhatsThis=A measuring ruler widget as seen in KWord for page widths and heights
|
|
||||||
Group=Display (KDE)
|
|
||||||
|
|
||||||
[KSeparator]
|
[KSeparator]
|
||||||
IncludeFile=kseparator.h
|
IncludeFile=kseparator.h
|
||||||
ToolTip=Standard horizontal or vertical separator.
|
ToolTip=Standard horizontal or vertical separator.
|
||||||
|
|
|
@ -11,7 +11,6 @@ install(
|
||||||
kled.png
|
kled.png
|
||||||
ksqueezedtextlabel.png
|
ksqueezedtextlabel.png
|
||||||
kurllabel.png
|
kurllabel.png
|
||||||
kruler.png
|
|
||||||
kdoublenuminput.png
|
kdoublenuminput.png
|
||||||
klistbox.png
|
klistbox.png
|
||||||
kactivelabel.png
|
kactivelabel.png
|
||||||
|
@ -20,7 +19,6 @@ install(
|
||||||
khsselector.png
|
khsselector.png
|
||||||
kcolorbutton.png
|
kcolorbutton.png
|
||||||
kgradientselector.png
|
kgradientselector.png
|
||||||
kdualcolorbutton.png
|
|
||||||
kpushbutton.png
|
kpushbutton.png
|
||||||
kcalendarwidget.png
|
kcalendarwidget.png
|
||||||
kdialog.png
|
kdialog.png
|
||||||
|
@ -30,8 +28,6 @@ install(
|
||||||
krestrictedline.png
|
krestrictedline.png
|
||||||
ktextedit.png
|
ktextedit.png
|
||||||
kurlcomborequester.png
|
kurlcomborequester.png
|
||||||
kkeybutton.png
|
|
||||||
kpalettetable.png
|
|
||||||
kactionselector.png
|
kactionselector.png
|
||||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kdewidgets/pics
|
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kdewidgets/pics
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 187 B |
Binary file not shown.
Before Width: | Height: | Size: 532 B |
Binary file not shown.
Before Width: | Height: | Size: 196 B |
Binary file not shown.
Before Width: | Height: | Size: 208 B |
Loading…
Add table
Reference in a new issue