Skip to main content

Cross-Qt compatibility module for IDAPython

Project description

Cross-Qt compatibility module for IDAPython.

What is it?

Cute is a tiny compatibility module, to allow IDAPython code to use PySide/Qt4 and PyQt/Qt5 seamlessly.

Motivation

Cute was originally a part of Sark (sark.qt). Since no-one likes dependencies, especially for things this small, no-one used it. So I decided to release it as a separate module as well, so that people can just take the file as-is and use it in their own code.

Usage

Qt Modules

Importing QtCore, QtGui and QtWidgets works for all Qt versions. For Qt4, QtWidgets is an alias for QtGui, so Qt5 code with QtWidgets / QtGui separation will work on Qt4 as well.

from cute import QtCure, QtGui, QtWidgets

Connecting to Signals

Cute offers a cute.connect(...) method to mitigate the difference between Qt4 and Qt5.

# Qt4 Code:
QtCore.QObject.connect(my_object, QtCore.SIGNAL('error(QProcess::ProcessError)'), my_callback)

# Qt5 Code:
my_object.error.connect(my_callback)

# Cute Code:
cute.connect(my_object, 'error(QProcess::ProcessError)', my_callback)

The API for disconnecting is the same, just use the cute.disconnect(...) function.

Form to Widget

IDA has 2 APIs for getting the widget associated with a TForm. One for PyQt and one for PySide. Cute wraps them both in one function.

my_widget = cute.form_to_widget(my_tform)

Which Qt Should I Use?

Sometimes, you do need to to know the Qt version your code uses. For those cases, ask the use_qt5 variable.

if cute.use_qt5:
    print 'Use Qt5'
else:
    print 'Use Qt4'

In a Project

There are two recommended ways to use Cute:

  1. Copy it into your own project. This way does create code duplication, but avoid dependencies.

  2. Install it as a package - pip install idacute.

Licensing

Cute is released under the MIT license, so you are free to use it in any project whatsoever.

FAQ

Q: Why did you name it “cute”?

A: For years I was sure “Qt” is pronounced “Q T”. This is my effort to remind myself it is not.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

idacute-1.0.1-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2Python 3

idacute-1.0.1-py2-none-any.whl (7.6 kB view details)

Uploaded Python 2

File details

Details for the file idacute-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: idacute-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for idacute-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8a8d7dbc3d345616db4616145d22f0dccdb0976c74a5cb4faabf7a5e446d2957
MD5 f8f9dad54ca800f05ab75b797be04a18
BLAKE2b-256 4830b9fd9c14694aed8923563c5cda9b3526baf0b1f2d06b49151185d9c923c9

See more details on using hashes here.

File details

Details for the file idacute-1.0.1-py2-none-any.whl.

File metadata

File hashes

Hashes for idacute-1.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 c70c168ab127a69bd4d6d507bb565eaad14ed645e7de361980438c1150515b95
MD5 0b4c85af8070157b3868a699af7c0bd1
BLAKE2b-256 3795479358e5d98e5bdad5a24788acd08c2d7d53b66e77cc40e5dcbed6954f80

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page