Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4548624
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:14:47+00:00 2026-05-21T16:14:47+00:00

I’m writing a database browser application with PyQt4 and because I’m new to Qt,

  • 0

I’m writing a database browser application with PyQt4 and because I’m new to Qt, I have some problems. I have most functionalities already written in python but know I’m trying to implement them with PyQt4 GUI.

First of all my application now looks like this:
Browser
In these catalogues I have xml files which I would like to parse.
I’ve written something like this:


QtCore.QObject.connect(self.ui.treeView, QtCore.SIGNAL("clicked(QModelIndex)"), self.ui.plainTextEdit, QtCore.SLOT("paste()"))

and it works. But when I’m trying to do something like this:

QtCore.QObject.connect(self.ui.treeView, QtCore.SIGNAL("clicked(QModelIndex)"), self.ui.plainTextEdit, QtCore.SLOT("insertPlainText('test')"))

it fails. After reading the manual I know that SIGNAL and SLOT must take the same arguments. So I should write some signal which executes a SLOT which is a function with QModelIndex argument which finds clicked file, creates the xmldocument object and then prints out it’s dictionaries.
My questions are:

    How can I create such function which is callable as SLOT?

Because inside ui file I created a function:


def test(self):
print "Debug"

And when I’m trying to call it out

QtCore.QObject.connect(self.ui.treeView, QtCore.SIGNAL("clicked(QModelIndex)"), self.ui.test())

I’m getting this error:

TypeError: arguments did not match any overloaded call:
QObject.connect(QObject, SIGNAL(), QObject, SLOT(), Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type 'NoneType'
QObject.connect(QObject, SIGNAL(), callable, Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type 'NoneType'
QObject.connect(QObject, SIGNAL(), SLOT(), Qt.ConnectionType=Qt.AutoConnection): argument 2 has unexpected type 'str'

And another question:

    How should I get path to clicked file from QModelIndex?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T16:14:48+00:00Added an answer on May 21, 2026 at 4:14 pm

    Consider using the new-style connection mechanism provided by PyQt:

    self.ui.treeView.clicked.connect(self.ui.plainTextEdit.paste)
    

    Now, paste is a method accepting a single argument, and this argument is of the type the clicked signal of self.ui.treeView sends. Dissect if from there, as you wish.


    How can I create such function which is callable as SLOT?

    It’s a different error. You connect to self.ui.test(), but this is a function call, not a function. Remove the () after test. But better yet, use the new-style connection mechanism as described above.


    How should I get path to clicked file from QModelIndex?

    Probably by calling its data method. Read the doc for QModelIndex

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a reasonable size flat file database of text documents mostly saved in
I have some data like this: 1 2 3 4 5 9 2 6
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.