PDA

View Full Version : Qt Creator Using KDE class



jcdole
21st October 2013, 11:44
Hello.

Qt 5.1.1
Qt Creator 2.8.1
KDE 4.10.5
OpenSuse 12.3
Linux 3.7.10-1.16-desktop

I would like to use KFontDialog

I cannot build my project under 5.1.1 because of this error :

/usr/include/kconfiggroup.h:745: error: 'qVariantCanConvert' was not declared in this scope

I have seen that qVariantCanConvert is deprecated.

The project build correctly under 4.8.

Any help is welcome.


mainwindow.h
------------------

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtDebug>
#include <kfontdialog.h>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();

private:
Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H


mainwindow.cpp
------------------

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);


QFont myFont;
int result = KFontDialog::getFont( myFont );
qDebug() << "Return Parameter is:" << result << endl;


}

MainWindow::~MainWindow()
{
delete ui;
}

wysota
21st October 2013, 14:00
Basically Qt5 and KDE 4 can't work together since KDE4 is based on Qt4.

anda_skoa
21st October 2013, 22:41
kfontdialog Qt5 version is part of the "kde4support" framework, making it likely that it has been mostly replaced by its Qt counterpart and only still exists for porting and corner cases.

Cheers,
_