• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kapptemplate

  • sources
  • kde-4.12
  • kdesdk
  • kapptemplate
  • templates
  • C++
  • kapp4
  • src
src/%{APPNAMELC}view.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
18  ***************************************************************************/
19 
20 #include "%{APPNAMELC}view.h"
21 #include "settings.h"
22 
23 #include <KLocale>
24 #include <QtGui/QLabel>
25 
26 %{APPNAME}View::%{APPNAME}View(QWidget *)
27 {
28  ui_%{APPNAMELC}view_base.setupUi(this);
29  settingsChanged();
30  setAutoFillBackground(true);
31 }
32 
33 %{APPNAME}View::~%{APPNAME}View()
34 {
35 
36 }
37 
38 void %{APPNAME}View::switchColors()
39 {
40  // switch the foreground/background colors of the label
41  QColor color = Settings::col_background();
42  Settings::setCol_background( Settings::col_foreground() );
43  Settings::setCol_foreground( color );
44 
45  settingsChanged();
46 }
47 
48 void %{APPNAME}View::settingsChanged()
49 {
50  QPalette pal;
51  pal.setColor( QPalette::Window, Settings::col_background());
52  pal.setColor( QPalette::WindowText, Settings::col_foreground());
53  ui_%{APPNAMELC}view_base.kcfg_sillyLabel->setPalette( pal );
54 
55  // i18n : internationalization
56  ui_%{APPNAMELC}view_base.kcfg_sillyLabel->setText( i18n("This project is %1 days old",Settings::val_time()) );
57  emit signalChangeStatusbar( i18n("Settings changed") );
58 }
59 
60 #include "%{APPNAMELC}view.moc"
Settings::setCol_foreground
static void setCol_foreground(const QColor &v)
Set color of the foreground.
Definition: C++/kapp4/src/settings.h:39
QWidget
class @6 QWidget
This is the main view class for %{APPNAME}.
Settings::col_background
static QColor col_background()
Get color of the background.
Definition: C++/kapp4/src/settings.h:30
%{APPNAMELC}view.h
settings.h
View
class SettingsHelper View
signalChangeStatusbar
void signalChangeStatusbar(const QString &text)
Use this signal to change the content of the statusbar.
APPNAME
main APPNAME
Settings::col_foreground
static QColor col_foreground()
Get color of the foreground.
Definition: C++/kapp4/src/settings.h:49
Settings::val_time
static int val_time()
Get size of a ball.
Definition: C++/kapp4/src/settings.h:59
Settings::setCol_background
static void setCol_background(const QColor &v)
Set color of the background.
Definition: C++/kapp4/src/settings.h:20
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:22 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kapptemplate

Skip menu "kapptemplate"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



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