[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: KIconView subclass is not displayed
From: Nikhil Marathe <nsm.nikhil () gmail ! com>
Date: 2005-10-02 5:11:10
Message-ID: e1dff1920510012159h70c8a50bu () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Below is the code
klinkiconview.h:
#ifndef KLINKICONVIEW_H#define KLINKICONVIEW_H
#include <kiconview.h>
*class* KAction;
*/****@author** Nikhil Marathe***/**class* KlinkIconView : *public* KIconView
{
*Q_OBJECT**public*:
KlinkIconView(QWidget* parent=0, const char* name=0);
~KlinkIconView();
*private* *slots*:
void showContextMenu(QIconViewItem *item, const QPoint & pos);
};
#endif
klinkiconview.cpp:
#include "klinkiconview.h"
#include <qaction.h>
#include <kpopupmenu.h>
KlinkIconView::KlinkIconView(QWidget* parent, const char* name):
KIconView(parent, name)
{
connect(this, SIGNAL(contextMenuRequested(QIconViewItem*, const QPoint&)),
this, SLOT(showContextMenu(QIconViewItem*, const QPoint& )));
}
KlinkIconView::~KlinkIconView()
{
}
#include "klinkiconview.moc"
/*!
\fn KlinkIconView::showContextMenu(QIconViewItem *item, const QPoint & pos)
*/
void KlinkIconView::showContextMenu(QIconViewItem * item, const QPoint & pos)
{
qWarning("HELLO");
KPopupMenu conMenu(this);
QAction *newKlinkAct = new QAction("New Klink", 'N', 0);
newKlinkAct->addTo(&conMenu);
conMenu.exec(pos);
}
When i remove Q_OBJECT and the slots it is displayed fine.
But if i add the Q_OBJECT macro i get an empty window without an iconview.
There are no errors during compilation.
Qt version - 3.3
Kde version - 3.4
-Nikhil
[Attachment #5 (text/html)]
Below is the code<br>
<br>
klinkiconview.h:<br>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Kate, the KDE Advanced Text Editor">
<pre><span style="color: rgb(0, 128, 0);">#ifndef KLINKICONVIEW_H</span>
<span style="color: rgb(0, 128, 0);">#define KLINKICONVIEW_H</span>
<span style="color: rgb(0, 128, 0);">#include <kiconview.h></span>
<b>class</b> KAction;
<span style="color: rgb(0, 0, 255);"><i>/**</i></span>
<span style="color: rgb(202, 96, 202);"><b>@author</b></span><span style="color: \
rgb(0, 0, 255);"><i> Nikhil Marathe</i></span> <span style="color: rgb(0, 0, \
255);"><i>*/</i></span> <b>class</b> KlinkIconView : <b>public</b> KIconView
{
<span style="color: rgb(0, 149, 255);"><b>Q_OBJECT</b></span>
<b>public</b>:
KlinkIconView(QWidget* parent=<span style="color: rgb(0, 0, 255);">0</span>, \
<span style="color: rgb(128, 0, 0);">const</span> <span style="color: rgb(128, 0, \
0);">char</span>* name=<span style="color: rgb(0, 0, 255);"> 0</span>);
~KlinkIconView();
<b>private</b> <span style="color: rgb(0, 149, 255);"><b>slots</b></span>:
<span style="color: rgb(128, 0, 0);">void</span> showContextMenu(QIconViewItem \
*item, <span style="color: rgb(128, 0, 0);">const</span> QPoint & pos); };
<span style="color: rgb(0, 128, 0);">#endif<br><br><br></span><font \
size="2"><span>klinkiconview.cpp:<br><br></span></font><font \
size="2"><span></span></font><font size="2"><span>#include \
"klinkiconview.h"<br><br> #include <qaction.h><br><br>#include \
<kpopupmenu.h><br><br>KlinkIconView::KlinkIconView(QWidget* parent, const char* \
name): KIconView(parent, name)<br>{<br> <br> connect(this, \
SIGNAL(contextMenuRequested(QIconViewItem*, const QPoint&)), <br> \
this, SLOT(showContextMenu(QIconViewItem*, const QPoint& \
)));<br>}<br><br><br>KlinkIconView::~KlinkIconView()<br>{<br>}<br><br>#include \
"klinkiconview.moc"<br><br>/*!<br> \fn \
KlinkIconView::showContextMenu(QIconViewItem *item, const QPoint & pos) <br> \
*/<br>void KlinkIconView::showContextMenu(QIconViewItem * item, const QPoint & \
pos)<br>{<br> qWarning("HELLO");<br> KPopupMenu conMenu(this);<br> \
QAction *newKlinkAct = new QAction("New Klink", 'N', 0); <br> \
newKlinkAct->addTo(&conMenu);<br> \
conMenu.exec(pos);<br>}<br></span></font><span style="color: rgb(0, 128, \
0);"></span></pre><br> <br>
When i remove Q_OBJECT and the slots it is displayed fine.<br>
But if i add the Q_OBJECT macro i get an empty window without an iconview.<br>
There are no errors during compilation.<br>
Qt version - 3.3<br>
Kde version - 3.4<br>
<br>
-Nikhil<br>
=
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscrib=
e <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic