Beginning KDE Programming”

Total Page:16

File Type:pdf, Size:1020Kb

Beginning KDE Programming” Beginning KDevelop Programming pseudonym67 Copyright (c) 2006 by pseudonym67. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, vX.Y or later (the latest version is presently available at http://www.opencontent.org/openpub/) About the Author Since becoming disabled from work and becoming practically house bound I have had a number of projects published on CodeProject. and have decided to play around with some stuff on Linux. All projects are the results of the few hours a day if any when I am neither asleep or ill and will hopefully continue to prevent me from climbing the walls. About This Project This project is the authors attempt to learn how to program using the KDE programming environment. It is by no means a C++ tutorial nor is it a general guide to setting up KDE in fact initially it wont even be a wide ranging look at KDE itself because the idea is to use a familiar environment to standard Windows programming which means that I will initially be concentrating on the Simple Designer Based KDE Application projects which is the KDE version of a rapid application development environment of the type that most windows programmers will be familiar with and will provide a less stressful introduction to Linux programming for people new to the KDE development environment. The idea is to provide a programming guide along the lines of the many Windows programming guides that can be found in any book shop, although being for Linux this guide will be freely available to all and as I am not being paid by the page it will not detail every single option like some books I could mention but will leave some of the details to the reader to discover. Requirements The project is developed using a standard set-up of Suse Linux 10 which comes with KDE 3. There will be no special settings or scripts to run basically if it doesn't work out of the box it wont be covered here. ( As with all rules there is an exception. This is the scripts used to set up MySQL ) Changes made through the use of the official Suse Updates that are downloaded through the Suse Watcher program are of course accepted. For people who are not as familiar with C++ as they would like to be or find they are having problems I'd recommend The C++ Programming Language or you could see what you can find on the web. Or you could just read the C++ Annotations book by Frank B. Brokken that comes as part of the KDevelop help documentation. On the whole we wont be using too much advanced C++ but readers should be familiar with at least function overloading, inheritance and constructors. All programs will be developed using the KDevelop KDE/C++ version of KDevelop. All other tools used will be part of the KDE setup so as long as KDE is installed they should be available on any Linux distribution. Release Schedule When there's something to release. Beginning KDevelop Programming KDE 3.x Version pseudonym67 [email protected] http://www.beginning-kdevelop-programming.co.uk/ Table of Contents Chapter 1 The Basics............................................................................................................................9 Version Control ...................................................................................................................14 Creating A Repository.....................................................................................................16 Viewing The Files...........................................................................................................18 Initialising The Repository..............................................................................................19 KDE Project Files.................................................................................................................20 The KDE Application Class.................................................................................................31 Summary..............................................................................................................................31 Chapter 2 The KDE Application........................................................................................................32 The Command Line..............................................................................................................33 Code Snippets.......................................................................................................................41 A Better Demonstration .......................................................................................................42 Coding Styles...................................................................................................................43 Adding The Demo Code..................................................................................................43 Debugging Code...................................................................................................................45 CVS The Easy Way..............................................................................................................52 Documentation.....................................................................................................................55 Generating The Documentation.......................................................................................60 Doxygen Options.............................................................................................................62 Generated Files.....................................................................................................................65 Summary..............................................................................................................................71 Chapter 3 Common Widgets..............................................................................................................72 Problems Building Forms.....................................................................................................82 Buttons..................................................................................................................................84 Tip Of The Day....................................................................................................................87 Boxes....................................................................................................................................88 Spacers..................................................................................................................................96 More On Layouts.............................................................................................................98 Edits....................................................................................................................................100 Tab Order.......................................................................................................................101 Chapter 4 Containers And Views.....................................................................................................103 Accelerators........................................................................................................................108 Graphical Connections.......................................................................................................108 The Views Demonstration .................................................................................................113 Adding Libraries To A Project .....................................................................................117 Selecting A Directory....................................................................................................122 Filling The Views..........................................................................................................124 Chapter 5 Database Programming With MySQL.............................................................................127 Order...................................................................................................................................127 1. Install My SQL..........................................................................................................127 2. MySQL_Install_DB...................................................................................................128 3. Start MySQL..............................................................................................................129 4. MySQL_Fix_Privilege_Tables..................................................................................130 5. Change Root Password..............................................................................................131 6. Uninstall MySQL......................................................................................................131 Using a DataTable..............................................................................................................146 Adding A Dialog...........................................................................................................146 Implementing The Dialog..............................................................................................154 Query The Database...........................................................................................................154 Tip Of The Day..................................................................................................................158 Using the DataBrowser......................................................................................................159
Recommended publications
  • KDE 2.0 Development, Which Is Directly Supported
    23 8911 CH18 10/16/00 1:44 PM Page 401 The KDevelop IDE: The CHAPTER Integrated Development Environment for KDE by Ralf Nolden 18 IN THIS CHAPTER • General Issues 402 • Creating KDE 2.0 Applications 409 • Getting Started with the KDE 2.0 API 413 • The Classbrowser and Your Project 416 • The File Viewers—The Windows to Your Project Files 419 • The KDevelop Debugger 421 • KDevelop 2.0—A Preview 425 23 8911 CH18 10/16/00 1:44 PM Page 402 Developer Tools and Support 402 PART IV Although developing applications under UNIX systems can be a lot of fun, until now the pro- grammer was lacking a comfortable environment that takes away the usual standard activities that have to be done over and over in the process of programming. The KDevelop IDE closes this gap and makes it a joy to work within a complete, integrated development environment, combining the use of the GNU standard development tools such as the g++ compiler and the gdb debugger with the advantages of a GUI-based environment that automates all standard actions and allows the developer to concentrate on the work of writing software instead of managing command-line tools. It also offers direct and quick access to source files and docu- mentation. KDevelop primarily aims to provide the best means to rapidly set up and write KDE software; it also supports extended features such as GUI designing and translation in con- junction with other tools available especially for KDE development. The KDevelop IDE itself is published under the GNU Public License (GPL), like KDE, and is therefore publicly avail- able at no cost—including its source code—and it may be used both for free and for commer- cial development.
    [Show full text]
  • Organizace a Vybavení Vojska V 15. Století: Paralelní Vývoj Ve Francii, Burgundsku a St Řední Evrop Ě
    UNIVERZITA KARLOVA V PRAZE FILOZOFICKÁ FAKULTA ÚSTAV ČESKÝCH D ĚJIN HISTORICKÉ V ĚDY Jan Biederman Organizace a vybavení vojska v 15. století: paralelní vývoj ve Francii, Burgundsku a st řední Evrop ě Organization and equipment of the army in 15 th century: parallel development in France, Burgundy and in the Central Europe DISERTA ČNÍ PRÁCE VEDOUCÍ DISERTA ČNÍ PRÁCE: doc. PhDr. Martin Nejedlý, Dr. PRAHA 2015 Prohlašuji, že jsem diserta ční práci napsal samostatn ě s využitím uvedených a řádn ě citovaných pramen ů a literatury a že práce nebyla využita v rámci jiného vysokoškolského studia či k získání jiného nebo stejného titulu. V Praze, dne 28. července 2015 ................................................. Klí čová slova ( česky) organizace vojska – zásobování – zbrojní výroba a výzbroj – palné zbran ě – transport Klí čová slova (anglicky) military organization – food supply – weapons production and armament – firearms – transport Abstrakt Organizace a vybavení vojska v 15. století: paralelní vývoj ve Francii, Burgundsku a st řední Evrop ě Tak jako v jiných epochách, i v pozdním st ředov ěku m ěla na kvalitách vojska klí čový podíl forma vojenské organizace, zajišt ění zásobování, technické možnosti a podmínky transportu a samoz řejm ě i povaha výzbroje. V této souvislosti byly d ůležité také dobové technické možnosti zbrojní výroby, obchodu se zbran ěmi a v neposlední řad ě též p řístup k progresivn ě se rozvíjející složce výzbroje, jíž p ředstavovaly palné zbran ě. Zám ěrem této práce je vzhledem ke zmín ěným tematickým okruh ům komparace oblasti st řední Evropy s důrazem na české zem ě a frankofonního západu Evropy, zastoupeného francouzským královstvím spolu s burgundským vévodstvím.
    [Show full text]
  • Note on Using the CS+ Integrated Development Environment
    Tool News RENESAS TOOL NEWS on April 16, 2015: 150416/tn2 Note on Using the CS+ Integrated Development Environment When using the CS+ IDE, take note of the problem described in this note regarding the following point. Statements in source code which form a deeply-nested block 1. Products Concerned Products from the following list for which the version number of the CS+ common program is 3.00.00 to 3.01.00. - RX Family C/C++ Compiler Package (with IDE) - RL78 Family C Compiler Package (with IDE) - RH850 Family C Compiler Package (with IDE) - CS+ evaluation edition To check the version number of the product you have, refer to the following URL. https://www.renesas.com/cubesuite+_ver 2. Description CS+ might be terminated forcibly when a program is downloaded to a debugging tool or when an editor panel is opened after downloading a program. 3. Conditions Forced termination may occur when the source code for a project includes code that meets any of the following conditions. (a) { } blocks nested to a depth of 128 or more within a function. (b) 64 or more consecutive "else if" conditions are in sequence. (c) The total of double the number of consecutive "else if" conditions and the depth of the nesting of {} blocks at some point in the sequence of consecutive "else if" conditions is 128 or more. With conditions (b) and (c) above, the problem only arises when the C99 option is designated and the product is the RX family C/C++ compiler package (with IDE). 4. Workaround To avoid this problem, do any of the following.
    [Show full text]
  • Red Hat Enterprise Linux 6 Developer Guide
    Red Hat Enterprise Linux 6 Developer Guide An introduction to application development tools in Red Hat Enterprise Linux 6 Dave Brolley William Cohen Roland Grunberg Aldy Hernandez Karsten Hopp Jakub Jelinek Developer Guide Jeff Johnston Benjamin Kosnik Aleksander Kurtakov Chris Moller Phil Muldoon Andrew Overholt Charley Wang Kent Sebastian Red Hat Enterprise Linux 6 Developer Guide An introduction to application development tools in Red Hat Enterprise Linux 6 Edition 0 Author Dave Brolley [email protected] Author William Cohen [email protected] Author Roland Grunberg [email protected] Author Aldy Hernandez [email protected] Author Karsten Hopp [email protected] Author Jakub Jelinek [email protected] Author Jeff Johnston [email protected] Author Benjamin Kosnik [email protected] Author Aleksander Kurtakov [email protected] Author Chris Moller [email protected] Author Phil Muldoon [email protected] Author Andrew Overholt [email protected] Author Charley Wang [email protected] Author Kent Sebastian [email protected] Editor Don Domingo [email protected] Editor Jacquelynn East [email protected] Copyright © 2010 Red Hat, Inc. and others. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
    [Show full text]
  • Embrace and Extend Approach (Red Hat, Novell)
    Integrated Development Environments (IDEs) Technology Strategy Chad Heaton Alice Park Charles Zedlewski Table of Contents Market Segmentation.............................................................................................................. 4 When Does the IDE Market Tip? ........................................................................................... 6 Microsoft & IDEs ................................................................................................................... 7 Where is MSFT vulnerable?................................................................................................. 11 Eclipse & Making Money in Open Source........................................................................... 12 Eclipse and the Free Rider Problem ..................................................................................... 20 Making Money in an Eclipse World?................................................................................... 14 Eclipse vs. Microsoft: Handicapping the Current IDE Environment ................................... 16 Requirements for Eclipse success......................................................................................... 18 2 Overview of the Integrated Development Environment (IDE) Market An Integrated Development Environment (IDE) is a programming environment typically consisting of a code editor, a compiler, a debugger, and a graphical user interface (GUI) builder. The IDE may be a standalone application or may be included as part of one or more existing
    [Show full text]
  • Java Code Documentation Example
    Java Code Documentation Example Fruitless Martino sometimes quick-freeze his peritonitis hugely and night-club so dispraisingly! Glottogonic and sublinear Finn melt his bodice permeates podding benevolently. Oswald usually medicines surgically or orbs telescopically when polyunsaturated Hugh dement evidentially and lewdly. The javadoc itself an unsupported extension and is also important in the description for code documentation comment merely repeats the banner section DocsapijavanetURLhtmlgetAuthority-- a method getAuhority in the. API reference code comments Google Developers. Omitting many times classes being documented type, and java example of each field, all trademarks and description below code completion window, which we used to. Java Programming Style Guide. The keyboard shortcut to comment multiple in Windows is shift alt A. 10 Best Practices to multiple While Writing Code Javarevisited. Concise presentations of java programming practices tasks and conventions amply illustrated with syntax highlighted code examples. Java Documentation Comments Tutorialspoint. Java Programming Guidelines. If this tag easily comment related comments java code, this user to new field in the dependency. The following examples demonstrate a pain line summary followed by detailed documentation in song three. CS 302 Commenting Guide Program Commenting Guide File. For sober you spawn use author tag to identify the author of a. Opinions expressed by the code example code documentation is overridden in the documentation for example code base classes and decide to allow bikes to achieve these methods. Example slope from the Javadoc documentation code can be documented inline Single Line comments are started by each may be positioned after a. The Documentation Comment Specification permits leading asterisks on enough first.
    [Show full text]
  • Using the GNU Debugger (Gdb) a Debugger Is a Very Useful Tool for Finding Bugs in a Program
    Using the GNU debugger (gdb) A debugger is a very useful tool for finding bugs in a program. You can interact with a program while it is running, start and stop it whenever, inspect the current values of variables and modify them, etc. If your program runs and crashes, it will produce a ‘core dump’. You can also use a debugger to look at the core dump and give you extra information about where the crash happened and what triggered it. Some debuggers (including recent versions of gdb) can also go backwards through your code: you run your code forwards in time to the point of an error, and then go backwards looking at the values of the key variables until you get to the start of the error. This can be slow but useful sometimes! To use a debugger effectively, you need to get the compiler to put extra ‘symbol’ information into the binary, otherwise all it will contain is machine code level – it is much more useful to have the actual variable names you used. To do this, you use: gfortran –g –O0 mycode.f90 –o mybinary where ‘-g’ is the compiler option to include extra symbols, -O0 is no optimization so the code is compiled exactly as written, and the output binary is called ’mybinary’. If the source files and executable file is in the same directory, then you can run the binary through the debugger by simply doing: gdb ./mybinary This will then put you into an interactive debugging session. Most commands can be shortened (eg ‘b’ instead of ‘break’) and pressing ‘enter’ will repeat the last command.
    [Show full text]
  • The Kdesvn Handbook
    The kdesvn Handbook Rajko Albrecht The kdesvn Handbook 2 Contents 1 Introduction 7 1.1 Terms . .7 2 Using kdesvn 8 2.1 kdesvn features . .8 2.2 Beginning with subversion and kdesvn . .8 2.2.1 Creating a working copy . .9 2.2.2 Committing local changes . .9 2.2.3 Update working copy . .9 2.2.4 Adding and Deleting from working copy . .9 2.2.4.1 Add items . 10 2.2.4.2 Deleting items from working copy and unversion . 10 2.2.5 Displaying logs . 10 2.2.5.1 The log display dialog . 10 2.3 Working on repositories . 11 2.3.1 Restoring deleted items . 11 2.3.2 Importing folders . 11 2.3.2.1 With drag and drop . 11 2.3.2.2 Select folder to import with directory-browser . 11 2.4 Other Operations . 11 2.4.1 Merge . 11 2.4.1.1 Internal merge . 12 2.4.1.2 Using external program for merge . 12 2.4.2 Resolving conflicts . 12 2.5 Properties used by kdesvn for configuration . 13 2.5.1 Bugtracker integration . 13 2.6 The revision tree . 13 2.6.1 Requirements . 14 2.7 Internal log cache . 14 2.7.1 Offline mode . 14 2.7.2 Log cache and revision tree . 14 The kdesvn Handbook 2.8 Meaning of icon overlays . 14 2.9 kdesvn and passwords . 16 2.9.1 Not saving passwords . 16 2.9.2 Saving passwords in KWallet . 16 2.9.3 Saving to subversion’s own password storage .
    [Show full text]
  • Qt5 Cadaques Release 2017-12
    Qt5 Cadaques Release 2017-12 JRyannel,JThelin Januar 26, 2018 at 22:39 CET Inhaltsverzeichnis 1 Meet Qt 5 3 1.1 Preface................................................3 1.2 Qt 5 Introduction...........................................4 1.3 Qt Building Blocks..........................................8 1.4 Qt Project............................................... 10 2 Get Started 11 2.1 Installing Qt 5 SDK......................................... 11 2.2 Hello World............................................. 11 2.3 Application Types.......................................... 13 2.4 Summary............................................... 21 3 Qt Creator IDE 23 3.1 The User Interface.......................................... 23 3.2 Registering your Qt Kit....................................... 24 3.3 Managing Projects.......................................... 24 3.4 Using the Editor........................................... 25 3.5 Locator................................................ 25 3.6 Debugging.............................................. 26 3.7 Shortcuts............................................... 26 4 Quick Starter 27 4.1 QML Syntax............................................. 27 4.2 Basic Elements............................................ 32 4.3 Components............................................. 36 4.4 Simple Transformations....................................... 39 4.5 Positioning Elements......................................... 42 4.6 Layout Items............................................. 46 4.7 Input Elements...........................................
    [Show full text]
  • KDE Free Qt Foundation Strengthens Qt
    How the KDE Free Qt Foundation strengthens Qt by Olaf Schmidt-Wischhöfer (board member of the foundation)1, December 2019 Executive summary The development framework Qt is available both as Open Source and under paid license terms. Two decades ago, when Qt 2.0 was first released as Open Source, this was excep- tional. Today, most popular developing frameworks are Free/Open Source Software2. Without the dual licensing approach, Qt would not exist today as a popular high-quality framework. There is another aspect of Qt licensing which is still very exceptional today, and which is not as well-known as it ought to be. The Open Source availability of Qt is legally protected through the by-laws and contracts of a foundation. 1 I thank Eike Hein, board member of KDE e.V., for contributing. 2 I use the terms “Open Source” and “Free Software” interchangeably here. Both have a long history, and the exact differences between them do not matter for the purposes of this text. How the KDE Free Qt Foundation strengthens Qt 2 / 19 The KDE Free Qt Foundation was created in 1998 and guarantees the continued availabil- ity of Qt as Free/Open Source Software3. When it was set up, Qt was developed by Troll- tech, its original company. The foundation supported Qt through the transitions first to Nokia and then to Digia and to The Qt Company. In case The Qt Company would ever attempt to close down Open Source Qt, the founda- tion is entitled to publish Qt under the BSD license. This notable legal guarantee strengthens Qt.
    [Show full text]
  • Qt Framework
    About Qt Qt is a framework to develop cross-platform applications. Currently, the supported platforms are Windows, Linux, macOS, Android, iOS, Embedded Linux and some others. Genarally, it means that the programmer may develop the code on one platform but compile, link and run it on another platform. But it also means that Qt needs help: to develop software it must cooperate with development tools on specific platforms, for example in case of Windows with Visual Studio. Qt is well-known for its tools for developing graphical user interfaces (GUI) , but it also provides powerful tools for threads, networking and communication (Bluetooth, serial port, web), 3D graphics, multimedia, SQL databases, etc. Qt has its own Integrated Development Environment (IDE): QtCreator. History: 1991: version 1.0 as cross-platform GUI programming toolkit was developed and implemented by TrollTech (Norway). 2005: version 4.0 was a big step ahead but the compatibility with older versions was lost. 2008: TrollTech was sold to Nokia. 2012: Nokia Qt division was sold to Digia (Finland). 2014: Digia transferred the Qt business to Qt Company. The latest Long Term Support (LTS) version is 5.12. Official website: https://www.qt.io/ Installation The link is https://www.qt.io/download. Select the non-commercial and open source version. It may be possible that you must register yourself creating a new passworded account. Select the latest stable release and the C/C++ development system(s) you are going to use. Tip: the Qt installer proposes to store the stuff in folder C:\Qt. To avoid later complications, agree.
    [Show full text]
  • Comments and Documentation 2501ICT/7421Ictnathan
    C Comments Using Doxygen Comments and Documentation 2501ICT/7421ICTNathan René Hexel School of Information and Communication Technology Griffith University Semester 1, 2012 René Hexel Comments and Documentation C Comments Using Doxygen Outline 1 C Comments 2 Using Doxygen René Hexel Comments and Documentation C Comments Using Doxygen Comments Plain C allows comments between /* and */ /* this is a valid C comment */ Comments may not be nested /* this /* is not a valid C comment */ */ C99 also allows double-slash // end-of-line comments // this is a valid comment no closing sequence needed – the comment ends at the end of the line René Hexel Comments and Documentation C Comments Using Doxygen Comment Example Example (Program with Comments) /* * This program prints "j = 007". * It does not take any parameters and returns 0 on success. */ int main(void)/ * main function definition */ { int j; // our int variable to play with j=7; // assign a value to be printed printf("j = %03.3dnn",j); // print value with leading zeroes return 0; // everything is fine, exit program } René Hexel Comments and Documentation C Comments Using Doxygen Where to put comments? At the beginning of each file (module) describe the name of the module, purpose, author, and dates when first created and last modified Before each function (method) describe the purpose of the function or method, input parameters (arguments), return values (output parameters), and pre- and postconditions (contract) At the beginning of each class describe the purpose of the class, and things to
    [Show full text]