I need some help qith QSlider
Markus Gustavsson
mighty at fragzone.se
Wed Jun 2 17:38:13 BST 1999
Hello.
I have a small (actually big) problem with QSlider, I know this isn't a QT help mailinglist,
but since I've been on the list since it all started and know some of you guys a bit by now,
I guess it's ok to ask for some help ;D A while ago, some weeks, I started on a KDE proj named
KAmp, it's suppose to become a WinAmp lookalike Mpeg3 player, and I'm on the GUI, It's worked
out all ok this far, (since this is my first QT/KDE and over all, first C++ project, it's been
quite ruff but it's starting to look ok by now), however (as you can see on the small screemdump)
I've ran into problems with QSlider when I should write the slider background and button mapping
functions, I've tried to reimplement drawWinGroove and paintSlider the same way I learned to
reimplement drawButton in QPushButton (which works ok now), but it still doesn't work.
I've tried to get some help by the KDE developers but no one has time for me, he he.
It would be great if someone could give me some advice on how to do this, I'm really on my own
now (atleast it feels like that), I've spent the last day trying to find someone who can help
me with the QSlider reimplementation wichout any success, It's really quite ruff to get help,
and it's ruff overall when I'm new to both the C++ lang and KDE/QT, but if I get help on this
one I'll not bug you with more questions during the rest of this millennium, I can promise you! :)
--
__ _
Markus Gustavsson / / (_)__ __ ____ __
Asperodsvaegen 12B / /__/ / _ \/ // /\ \/ /
45134 Uddevalla, Sweden /____/_/_//_/\_,_/ /_/\_\
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kamp.jpg
Type: image/jpeg
Size: 7836 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/19990602/17266dad/attachment.jpg>
-------------- next part --------------
/***************************************************************************
volume.cpp - Volume sliderbar Widget.
-------------------
begin : Sun May 30 1999
copyright : (C) 1999 by Markus Gustavsson
email : mighty at fragzone.se
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "volume.h"
#include <iostream.h>
Volume::Volume(SkinParser *Parser, QWidget *parent, bool initSize, const char *name) : QSlider(0, 150, 1, 75, QSlider::Horizontal, parent, name)
{
Size = initSize;
if(Size) {
resize(136, 24);
Slider = Parser->ds_volbarSlider;
Button = Parser->ds_volbarButton;
} else {
resize(68, 12);
Slider = Parser->volbarSlider;
Button = Parser->volbarButton;
}
}
Volume::~Volume()
{
}
void Volume::setSkin(SkinParser *Parser)
{
/*
if(Parser) Skin = Parser;
if(Size) for(i = 0; i < 2; i++) Box[i]->setSkin(Skin->ds_shufrep[i]);
else for(i = 0; i < 2; i++) Box[i]->setSkin(Skin->shufrep[i]);
*/
}
void Volume::setSize(bool newSize)
{
Size = newSize;
setSkin();
if(Size) resize(136, 24);
else resize(68, 12);
}
void Volume::drawWinGroove(QPainter *Painter, QCOORD c)
{
Painter->drawPixmap(0, 0, Slider[10]);
cout << "Hello!" << endl;
}
void Volume::paintSlider(QPainter *Painter, QRect rect)
{
Painter->drawPixmap(0, 0, Button[0]);
cout << "Hello!" << endl;
}
-------------- next part --------------
/***************************************************************************
volume.h - Volume sliderbar Widget.
-------------------
begin : Sun May 30 1999
copyright : (C) 1999 by Markus Gustavsson
email : mighty at fragzone.se
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef VOLUME_H
#define VOLUME_H
#include <qslider.h>
#include <qpixmap.h>
#include <qpainter.h>
#include <qrect.h>
#include "skinparser.h"
class Volume : public QSlider {
Q_OBJECT
public:
Volume(SkinParser *Parser = 0, QWidget *parent = 0, bool initSize = FALSE, const char *name = 0);
~Volume();
/* Main control functions. */
void setSkin(SkinParser *Parser = 0);
void setSize(bool);
private:
bool Size;
QPixmap Slider[28];
QPixmap Button[2];
protected:
void drawWinGroove(QPainter *, QCOORD);
virtual void paintSlider(QPainter *, QRect);
};
#endif
More information about the KDevelop
mailing list