Logo Search packages:      
Sourcecode: gtk-kde4 version File versions  Download package

widg.cpp

/***************************************************************************
 *   Copyright (C) 2008 by Apocalypse                                *
 *   muwee@gala.net                                            *
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *   This program 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 General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#include <QtGui>
#include <QDebug>
#include "form1.h"
#include "widg.h"

widg::widg(QWidget * parent) : QWidget(parent)
{
      this->resize(640,1024);
}

widg::~widg() {
}
void widg::paintEvent(QPaintEvent*) {
      QStyleOptionButton sob;
      QStyleOptionProgressBar sopb;
      QStyleOptionTabV2 sot;
      QStyleOptionSlider sos;
      QStyleOptionMenuItem somi;
      QStyleOptionHeader soh;
      QStyleOption so;
      somi.initFrom(this);
      sob.initFrom(this);
      sopb.initFrom(this);
      soh.initFrom(this);
      sos.initFrom(this);
      sot.initFrom(this);
      so.initFrom(this);
      QPainter painter(this);
      /*option.rect=QRect(5,5,10,10);
      style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &option, &painter, this);*/
      //buttons
      sob.state = QStyle::State_Enabled;
      sob.rect=QRect(5,5, 93,22);
      style()->drawControl(QStyle::CE_PushButton, &sob, &painter, this);
      sob.rect=QRect(5,30, 93,22);
      sob.state |= QStyle::State_MouseOver; 
      style()->drawControl(QStyle::CE_PushButton, &sob, &painter, this);
      sob.rect=QRect(5,55, 93,22);
      sob.state = QStyle::State_Sunken; 
      style()->drawControl(QStyle::CE_PushButton, &sob, &painter, this);
      sob.rect=QRect(5,80, 93,22);
      sob.palette.setCurrentColorGroup(QPalette::Disabled); 
      sob.state &= ~QStyle::State_Enabled & ~QStyle::State_Sunken;
      style()->drawControl(QStyle::CE_PushButton, &sob, &painter, this);
      //checkBoxes && radioButtons
      sob.palette.setCurrentColorGroup(QPalette::Active); 
      sob.state = QStyle::State_Enabled;
      sob.rect=QRect(100,5, 23,23);
      style()->drawControl(QStyle::CE_CheckBox, &sob, &painter, this);
      sob.rect=QRect(125,5, 23,23);
      style()->drawControl(QStyle::CE_RadioButton, &sob, &painter, this);
      sob.state |=QStyle::State_MouseOver;
      sob.rect=QRect(100,30, 23,23);
      style()->drawControl(QStyle::CE_CheckBox, &sob, &painter, this);
      sob.rect=QRect(125,30, 23,23);
      style()->drawControl(QStyle::CE_RadioButton, &sob, &painter, this);
      sob.state &= ~QStyle::State_Enabled; 
      sob.palette.setCurrentColorGroup(QPalette::Disabled); 
      sob.rect=QRect(100,55, 23,23);
      style()->drawControl(QStyle::CE_CheckBox, &sob, &painter, this);
      sob.rect=QRect(125,55, 23,23);
      style()->drawControl(QStyle::CE_RadioButton, &sob, &painter, this);
      sob.palette.setCurrentColorGroup(QPalette::Active); 
      sob.state = QStyle::State_On;
      sob.state |= QStyle::State_Enabled;
      sob.rect=QRect(100,80, 23,23);
      style()->drawControl(QStyle::CE_CheckBox, &sob, &painter, this);
      sob.rect=QRect(125,80, 23,23);
      style()->drawControl(QStyle::CE_RadioButton, &sob, &painter, this);
      sob.state |=QStyle::State_MouseOver;
      sob.rect=QRect(100,105, 23,23);
      style()->drawControl(QStyle::CE_CheckBox, &sob, &painter, this);
      sob.rect=QRect(125,105, 23,23);
      style()->drawControl(QStyle::CE_RadioButton, &sob, &painter, this);
      sob.state &= ~QStyle::State_Enabled; 
      sob.palette.setCurrentColorGroup(QPalette::Disabled); 
      sob.rect=QRect(100,130, 23,23);
      style()->drawControl(QStyle::CE_CheckBox, &sob, &painter, this);
      sob.rect=QRect(125,130, 23,23);
      style()->drawControl(QStyle::CE_RadioButton, &sob, &painter, this);
      //progressBar
      sopb.maximum=100;
      sopb.progress=100;
      sopb.rect=QRect(5,155,300,30);
      style()->drawControl(QStyle::CE_ProgressBarGroove, &sopb, &painter, this);
      sopb.rect=QRect(5,190,300,30);
      style()->drawControl(QStyle::CE_ProgressBar, &sopb, &painter, this);
      //tabs
      sot.shape = QTabBar::RoundedNorth;
      sot.position = QStyleOptionTab::Middle;
      sot.rect=QRect(435,5,75,30);
      style()->drawControl(QStyle::CE_TabBarTab, &sot, &painter, this);
      sot.state = QStyle::State_Selected; 
      sot.rect=QRect(355,5,75,30);
      style()->drawControl(QStyle::CE_TabBarTab, &sot, &painter, this);
      //scrollbars
      sos.rect=QRect(150,5,20,126);
      style()->drawControl(QStyle::CE_ScrollBarSlider, &sos, &painter, this);
      sos.rect=QRect(225,5,23,19);
      style()->drawControl(QStyle::CE_ScrollBarSubPage, &sos, &painter, this);
      sos.rect=QRect(20,250,16,20);
      style()->drawControl(QStyle::CE_ScrollBarSubLine, &sos, &painter, this);
      sos.rect=QRect(175,5,20,126);
      sos.state|=QStyle::State_MouseOver;
      style()->drawControl(QStyle::CE_ScrollBarSlider, &sos, &painter, this);
      sos.rect=QRect(20,270,16,20);
      style()->drawControl(QStyle::CE_ScrollBarSubLine, &sos, &painter, this);
      sos.palette.setCurrentColorGroup(QPalette::Disabled); 
      sos.state &= ~QStyle::State_Enabled; 
      sos.rect=QRect(200,5,20,126);
      style()->drawControl(QStyle::CE_ScrollBarSlider, &sos, &painter, this);
      sos.rect=QRect(20,290,16,20);
      style()->drawControl(QStyle::CE_ScrollBarSubLine, &sos, &painter, this);
      //menu
      somi.state|=QStyle::State_Selected;
      somi.rect=QRect(225,30,60,25);
      style()->drawControl(QStyle::CE_MenuBarItem, &somi, &painter, this);
      somi.rect=QRect(225,60,100,24);
      style()->drawControl(QStyle::CE_MenuItem, &somi, &painter, this);
      //after Oxy fix 
      /*somi.state=QStyle::State_Enabled;
      somi.rect=QRect(225,90,86,34);
      style()->drawControl(QStyle::CE_MenuEmptyArea, &somi, &painter, this);*/
      //after Oxy fix,  it means never! :(
      //sliders
      sos.palette.setCurrentColorGroup(QPalette::Active); 
      sos.state=QStyle::State_Enabled;
      sos.subControls=QStyle::SC_SliderHandle;
      sos.rect=QRect(330,5,20,30);
      style()->drawComplexControl(QStyle::CC_Slider, &sos, &painter, this);
      sos.state|=QStyle::State_MouseOver;
      sos.rect=QRect(330,40,20,30);
      style()->drawComplexControl(QStyle::CC_Slider, &sos, &painter, this);
      sos.state=QStyle::State_Enabled;
      sos.palette.setCurrentColorGroup(QPalette::Disabled);
      sos.rect=QRect(330,75,20,30);
      style()->drawComplexControl(QStyle::CC_Slider, &sos, &painter, this);
      sos.subControls=QStyle::SC_SliderGroove;
      sos.palette.setCurrentColorGroup(QPalette::Active);
      sos.rect=QRect(330,105,19,27);
      style()->drawComplexControl(QStyle::CC_Slider, &sos, &painter, this);
      //arrows
      so.rect=QRect(435,55,15,16);
      style()->drawPrimitive(QStyle::PE_IndicatorArrowUp, &so, &painter, this);
      so.rect=QRect(435,75,15,16);
      style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &so, &painter, this);
      so.rect=QRect(435,95,15,16);
      style()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &so, &painter, this);
      so.rect=QRect(435,115,15,16);
      style()->drawPrimitive(QStyle::PE_IndicatorArrowRight, &so, &painter, this);
      so.palette.setCurrentColorGroup(QPalette::Disabled);
      so.rect=QRect(435,135,15,16);
      style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &so, &painter, this);
      //table
      soh.rect=QRect(355,55,77,25);
      style()->drawControl(QStyle::CE_Header, &soh, &painter, this);
      soh.state|=QStyle::State_MouseOver;
      soh.rect=QRect(355,85,77,25);
      style()->drawControl(QStyle::CE_Header, &soh, &painter, this);
      soh.state&=~QStyle::State_Enabled;
      soh.palette.setCurrentColorGroup(QPalette::Disabled);
      soh.rect=QRect(355,115,77,25);
      style()->drawControl(QStyle::CE_Header, &soh, &painter, this);
      
      
}

Generated by  Doxygen 1.6.0   Back to index