• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Interfaces

  • interfaces
  • terminal
  • example
main.cc
Go to the documentation of this file.
1#include "main.h"
2
3#include <QtCore/QDir>
4
5#include <kde_terminal_interface.h>
6#include <KParts/Part>
7#include <KService>
8#include <KAboutData>
9#include <KCmdLineArgs>
10#include <KApplication>
11
12Window::Window()
13{
14 this->resize(800,600);
15
16 KService::Ptr service = KService::serviceByDesktopName("konsolepart");
17 Q_ASSERT(service);
18
19 KParts::ReadOnlyPart* part = service->createInstance<KParts::ReadOnlyPart>(this, this, QVariantList());
20 Q_ASSERT(part);
21
22 setCentralWidget( part->widget() );
23
24 TerminalInterface* interface = qobject_cast<TerminalInterface*>(part);
25 interface->showShellInDir(QDir::home().path());
26
27 connect(part, SIGNAL(destroyed()), this, SLOT(deleteLater()));
28}
29
30int main( int argc, char** argv )
31{
32 KAboutData* about = new KAboutData( "tetest", 0, ki18n("TETest"), "0.1" );
33 KCmdLineArgs::init( argc, argv, about );
34 KApplication app;
35 Window* window = new Window();
36 window->show();
37 return app.exec();
38};
39
KAboutData
KApplication
KCmdLineArgs::init
static void init(const KAboutData *about)
KParts::Part::widget
virtual QWidget * widget()
KParts::ReadOnlyPart
KService::serviceByDesktopName
static Ptr serviceByDesktopName(const QString &_name)
KSharedPtr< KService >
TerminalInterface
TerminalInterface is an interface implemented by KonsolePart to allow developers access to the Konsol...
Definition: kde_terminal_interface.h:86
TerminalInterface::showShellInDir
virtual void showShellInDir(const QString &dir)=0
Window
Definition: main.h:7
Window::Window
Window()
Definition: main.cc:12
kde_terminal_interface.h
ki18n
KLocalizedString ki18n(const char *msg)
main
int main(int argc, char **argv)
Definition: main.cc:30
main.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Interfaces

Skip menu "Interfaces"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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