LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-05-2007, 12:17 AM   #1
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Rep: Reputation: 30
QObject won't connect


Let's get to the point with code.
Code:
#include <qapplication.h>
#include <qpushbutton.h>
#include <iostream>
#include "FileWindow.h"

class QFileViewer : public QWidget
{
  FileInfo fi;
  QPushButton* bup;
  QListView* lv;
public:
  QFileViewer();
  virtual void resizeEvent(QResizeEvent* re);
  void populate();
public slots:
  void upper();
};

QFileViewer::QFileViewer()
{
  lv = new QListView(this);
  lv->addColumn( "File" );
  lv->addColumn( "Owner" ); 
  lv->addColumn( "Group" );
  lv->addColumn( "Permissions" ); 

  populate();
  bup = new QPushButton("Up", this);
  connect(bup, SIGNAL(clicked()), this, SLOT(upper()));
}

void QFileViewer::resizeEvent(QResizeEvent* re)
{
  lv->move(0, bup->height() );
  lv->resize(re->size().width(), re->size().height() - bup->height() );
}

void QFileViewer::populate()
{
  fi.open();
  while( fi.nextFile())
  {
    if ( !fi.isHidden() )
      new QListViewItem( lv, fi.getName().c_str(), fi.getOwner().c_str(), fi.getGroup().c_str(), fi.getPermissions().c_str() );
  }
  fi.close();
}

void QFileViewer::upper()
{
  fi.up();
  lv->clear();
  populate();
}

int main( int argc, char ** argv ) {
    QApplication a( argc, argv );
    QFileViewer* mw = new QFileViewer();
    //mw->setCaption( "Install Script Maker" );
    mw->show();
    a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
    return a.exec();
}
Why does my program complain that slot upper does not exist? I get a message saying no such slot QWidget::upper().
 
Old 12-05-2007, 12:45 AM   #2
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
Ooops, forgot to include Q_OBJECT in my class.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Intel 4965 AGN - can't connect to wireless 802.11b router, can connect to 11g siodine Linux - Wireless Networking 3 12-01-2007 07:36 AM
connect to internet trough wireless others connect to me with lan Amir Menesy Linux - Wireless Networking 1 11-13-2007 08:28 PM
how i connect (bridging) two internet connection and how to use that both the connect karthi26 Linux - Newbie 1 08-26-2007 03:10 AM
Unix-connect: can't connect to server jrdioko Linux - Software 1 01-08-2006 04:56 PM
Samba: can't connect to my local linux machine but can connect to windows. Royle Linux - Networking 3 01-18-2005 05:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration