Skip to content

Language Bindings

You're using Qt with other languages than C++, eh? Post here!
853 Topics 3.3k Posts
  • 0 Votes
    3 Posts
    2k Views
    K

    This is not a problem with the Python binding. I only wrote it in python because the code is smaller. If you translate it in C++ you get the same efffect.

  • 0 Votes
    2 Posts
    3k Views
    N

    Solved it myself :)

    Here is the python code for anyone who needs it in the future:

    @brush = QtGui.QBrush()
    color = QtGui.QColor(R, G, B) # insert RGB values
    brush.setColor(color)
    treeItem.setForeground(0, brush)@

    hope it helps!!

  • How to edit data in a TableModel/TableView?

    2
    0 Votes
    2 Posts
    5k Views
    A

    You should override flags() method from QAbstractItemModel.
    @
    Qt::ItemFlags Model::flags(const QModelIndex &index) const
    {
    Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index);

    if (index.isValid()) return Qt::ItemIsEditable | defaultFlags; else return defaultFlags;

    }@

    Sorry for c++ code))

  • 0 Votes
    5 Posts
    5k Views
    N

    Nvm, got it:
    @
    if a != "":
    list = tree2.findItems(a, QtCore.Qt.MatchExactly, 0)
    for i in list:
    tree2.setCurrentItem(i)@

    Hope that helps for anyone else!! :)

  • QtScript and XML

    7
    0 Votes
    7 Posts
    5k Views
    F

    BTW, here is the link to this issue: https://code.google.com/p/qtscriptgenerator/issues/detail?id=81

  • Why QScriptValue and not QVariant?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Clicked() signal for QListView in Ruby

    3
    0 Votes
    3 Posts
    3k Views
    O

    Hello CeesZ,

    Looks great I will try!

  • Uniform Qt bindings for JRuby and Ruby

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • Basic Text editor with QTJambi

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Pyside QThreadPool problem

    2
    0 Votes
    2 Posts
    4k Views
    G

    By changing line 7:
    @class Test:@

    to
    @class Test(object):@

    it's not running into segfaults anymore on my system.

    Using old-style classes (not using the ultimate 'object' base class) in Python is being discouraged for quite some time now and this makes me think PySide can't handle them, or this is just a bug.

  • PyQt Phonon Video Player memory leak

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • QtJambi 4.8 incl. Qt3D

    8
    0 Votes
    8 Posts
    5k Views
    F

    @Smar: okay good :) I haven't tried QtJambi yet but lately my interest into a Java-Qt binding has increased much so I tried to find out about progress but finding up2date information was pretty hard.

    Imho blogging more often would help to some part - especially about the "roadmap"
    maybe a post about "how to help" would also be good (simple junior tasks?)

    Are there any plans for Qt5 yet? What about the whole QtScript/V8 stuff?

    Maybe a "live ticker" of commits somewhere visible on the homepage to help show the project is alive.

    [edit:] and no the "Recent activity" link doesn't help that much because on gitorious the first repository visible is shown as unmaintained and if you scroll down to the list of recent activity there are 90% of activity of repo creation/deletion - which doesn't show coding progress :( So a commit tracker of qtjambi-community (that's the current head isn't it?) may be the right thing.

  • [PySide]How to emit a multi-arguments signal.

    3
    0 Votes
    3 Posts
    3k Views
    R

    This one.

    @self.findPrevious.emit(text, cs)@

    But, I think signal can not emit multi-arguments in PySide.

    However, C++ can it.

    @emit findPrevious(text, cs);@

  • Compiling Qt Jambi for QT 4.8 fails

    3
    0 Votes
    3 Posts
    3k Views
    S

    Yes, I've completely forgotten about writing it here. This is indeed the solution. The comments in the buildpath.properties kinda confused me, I thought setting the QTDIR variable would configure everything but that was not the case.

    Thanks for writing the solution here.

  • PySide: 'QtGui.framework Library not Loaded'

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Qt metamodel

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Custom signals

    2
    0 Votes
    2 Posts
    2k Views
    D

    Yes, as signal is member of class instead of instance.

  • PySide passing parent self to child widgets

    2
    0 Votes
    2 Posts
    3k Views
    A

    Apologies, suddenly it occurred to me, so in case someone else is wondering too:

    self keeps the scope of the object alive

    for example if a child widget is created in a parent method, the child will be garbage collected by python if self is not passed to it (making the object a child of the parent widget) or a reference is kept on the parent object i.e.

    @

    example 1

    def create_tray_icon(self):
    # without self the tray object is deleted on exit of this method
    # but passing self makes the parent widget own the child object
    tray = QtGui.QSystemTrayIcon(QtGui.QIcon(":/icon.png"), self)
    @
    @

    example 2

    def create_tray_icon(self):
    # we don't pass self but the parent has a reference to tray (self.tray)
    # so the tray object will not be deleted until the parent is.
    self.tray = QtGui.QSystemTrayIcon(QtGui.QIcon(":/icon.png"))
    @

  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • Populating table cells with various widgets

    7
    0 Votes
    7 Posts
    9k Views
    F

    bq. for scalability reasons, the Q*Widget should only be used for static content

    you mean in this case using QTableWidget will be too slow for large tables as opposed to sub classing QTableView and building the required stuff yourself?
    Someone pointed out the QTableWidget.setCellWidget method which lets you do what I'm after very easily, but according to what you are suggesting this will become a problem?
    I'm just really trying to learn things the right way if possible so please excuse my ignorant questions

    bq. You are in charge of creating the corresponding widget for the cell. This is the QStyledItemDelegate::createEditor role.

    thanks, I will investigate that more.