Skip to main content

Posts

Showing posts from November, 2010

Image Resizer Example [Qt]

I've been making a small example to resize images, then did not want to just archive it, so I thought about sharing it. Images to resize are added to the list through the above buttons or drag/drop. A preview of the selected image appears along with width and height (in pixels). One scale is set to resize all the images. Icons used in the example are all free:  http://tango.freedesktop.org/ The complete example is here: [ Qt code ] - [ Executable ] Please tell me if you find a bug, or edit it. Blog Example by Mahmoud Adly Ezzat is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License .

Setting up Environment for AIR-Android Development

This entry will be for ONLY setting up the environment of Adobe AIR development on an Android virtual device, without any programming. To do this, we will have to do some heavy download: 1- Android SDK [ android-sdk_r07-windows.zip ] 2- Adobe Flash CS5 3- Adobe Flash Professional CS5 Extension for Adobe AIR 2.5 [ flashpro_extensionforair_p1_102510.zxp ] 4- Adobe AIR SDK [ AdobeAIRSDK.zip ] After downloading all these stuff, lets install: 1- Adobe Flash Professional CS5 2- Adobe Flash Professional CS5 Extension for Adobe AIR 2.5 Beware, if you are using Windows Vista or Windows 7, the installation will fail because you need some administrator privileges. So you'll have to go to the 'exe' file of Adobe Extension Manager CS5 [for example, C:\Program Files\Adobe\Adobe Extension Manager CS5] and right click on 'Adobe Extension Manager CS5.exe' and choose 'Run as administrator'. When it opens, choose File -> Install Extension and browse to flash...

[Qt] Kinetic Scrolling: Ariya's Example Arabic Wrapper

I've been looking for a way to implement kinetic scrolling. And I found it here , it was a great example for kinetic scrolling but neither commented nor ready to use in other projects. So, I worked on it, put comments on some important lines of code, added some options, and wrapped it in an easy-to-use class. This class can be used in the design like any widget you may have used; like QListWidget for example. Here are the features of this class: - Right alignment and Arabic text support. - Icon/Iconless view. - The choice of background/selection colors. - Emits a signal if an item is selected twice (better than double clicking). Here are the emportant methods and signals you'll need [FlickableList] public: FlickableList(bool withIcons = false, QWidget *parent = 0); void addItem(QString itemString); void addItem(QString itemString, QPixmap icon); void setBackgroundColor(QColor backgroundColor); void setSelectedItemColor(QColor selectedItem...

Passing Parameters to a QMetaObject in Qt

The target scenario is as follows: - Window(A) calls Window(B) and then Window(A) is closed. - When Window(B) is closed we want to go back to Window(A). But Window(A) needs some parameters in the constructor. How to know these parameters, an the exact values? One solution is to pass the previously known parameters from (A) to (B), then when (B) is destroyed, it will create an instance from (A) with these parameters. But this is not generic, because if (B) is called in an application by two different windows, how do we know which Window(A or C) called it? To make the process more generic, here is a solution: In Window(A): make a 'struct' containing all the parameters needed by the constructor. Make a new constructor for class (A) that takes a void pointer ( void * myPointer) and has a macro Q_INVOKABLE before it. ex: WindowA(int number, QString text); Q_INVOKABLE WindowA(void* params); In the original constructor, save the parameters in the struct you made ex: ...