Skip to content

Recent Articles

26
Nov

Приватные слоты в паттерне Pimpl от Qt.

Вступление.

Недавно я писал по поводу реализации паттерна Pimpl в библиотеке Qt и призывал людей следовать такому подходу при разработке их собственных бибиотек. Теперь я хочу поговорить о таком понятии, как приватные слоты и тем самым продолжить эту тему. Заключительной статьей на эту тему будет реализация механизма Implicit Sharing и shared d-pointer.

Что это и зачем это нужно.

Приватные слоты – это механизм дополняющий функционал d-указателей. Он позволяет реализовать слоты для приватного класса, даже если он не является наследником от QObject (обычно он им и не является), но для этого публичный класс должен быть наследником от QObject. Тоесть по факту создается некий приватный слот в публичном классе и он непосредственно дергает нужный метод приватного класса.
Зачем это нужно? Ну рассмотрим на примере. Есть класс QAbstractScrollArea. Он просто отображает некий виджет (viewport) и обеспечивает прокрутку. Прокрутка обеспечивается с помощью двух экземпляров класса QScrollBar. Сами эти скролбары он хранит в приватном классе. Теперь проблемма: как подключить сигнал от скроллбара об изменение его позиции с классом QAbstractScrollAreaPrivate, ведь он не является QObject’ом ? Сделать его наследником от QObject – лучше не делайте это :-) . Можно сделать слот в публичном классе и повесить на него, то в таком случае это не очень красиво – так как наружу выходят слоты от внутренней реализации. Вот ту Qt-шниками был придуман достаточно разумный и элегантный подход – приватные слоты.

Read moreRead more


Unique visitors to post: 53

21
Nov

Pimpl’s, d-pointer’s, cheshire cat’s source code example.

This post is part of this post
.pro file:

TEMPLATE = lib
HEADERS += myclass.h \
    myclass_p.h \
    myclassderived.h \
    myclassderived_p.h
SOURCES += myclass.cpp \
    myclassderived.cpp

Read moreRead more


Unique visitors to post: 36

21
Nov

Pimpl. D-pointer. Or Cheshire cat by Qt.

Introduction.

Qt Logo

Qt Logo


You can find Pimpl declaration in Qt documentation, while serfing in Assistent or qt doc site. Also those, Who looked inside in source code of Qt libraries, can found some strange macros: Q_DECLARE_PRIVATE, Q_D, and strange header files with names, ended with “_p.h”. Do you want to know something about this Qt’s Magic ?
In this post I am going to light this magic, and show you that it’s raser simple and useful (And why Qt hide this from us? :-) ).
Also this post may be useful for hacking or reversing Qt source code. This information helps you better understand of structure and relaying of Qt classes.
Русская версия
Read moreRead more


Unique visitors to post: 252

20
Nov

Pimpl. D-pointer. Или чеширский кот по версии Qt.

English version.

Вступление.

Qt Logo

Qt Logo

Часто в документации от Qt встречается термин Pimpl. Кроме того, те кто хоть немного копался в исходном коде Qt часто видел такие макросы как: Q_DECLARE_PRIVATE, Q_D. А также встречал так называемые приватные заголовочные файлы, название которых заканчивается на “_p.h”.
В этой статье я попробую приоткрыть ширму за всей это структурой.
Read moreRead more


Unique visitors to post: 227

27
Oct

Code less, Create more, Deploy everywhere. Indeed ? Part 1: Introduction.

Hello All. I just think about Cross-platform development of end-user application. And found that it’s much more difficult than might be. I think it’s terrible and it’s break’s IT evolution at all. :-( It’s very sad, and It’s time to think about decision.
Maybe you think I’m drank or it’s paranoia ? Maybe, But let’s see more detailed on it.

What we haver now ?

In our days we have two main branches of end-user hardware devices:
1. portable/embedded/low-resources devices
2. desktop/laptop devices

First category is handled devices, PDA, communicators, Set Top Boxes, industrial devices, Digital Secure Systems, Smart Houses, Phones, Multimedia centers, etc… Let’s call them embedded systems: ES.
The second category is personal computers and laptops. Let’s call them desktop systems: DS.

Read moreRead more


Unique visitors to post: 12

23
Oct

Old Friends grate meeting (Встреча старых друзей :-) )

Hi All. I added photo gallery on meeting with old friends.
Добрый день всем. Вот состоялась встреча выпускников ПВИЗ 2004 года выпуска, группы в которой я учился :-)

Фотоотчет выложил по адресу:
Путь к фоотчетам :-)

Комменты можно писать здесь :-)

PVIZ meeting 2009

PVIZ meeting 2009


Unique visitors to post: 8

24
Jun

Hello world, from my blog!

Hello. It’s my first blog post.

First of all a couple of words about me. My name Rudenko Eugene. I’m software developer. The main target of this blog is to share for everyone me research and development experiences.

And now start. I choose for blog GoDaddy’s hosting. I like it and I’ll see what will be in future. I found that WordPress is great blogging system, thanks guys for this product and thank a lot for people that make it more extended with a great collection of plugins and extensions.

And now, the main question !!! What is this block about ? The answer: about me and my research and development (R&D). I’ll try to tell you about interesting hacks and show you how to do it and where to find info to get more information.

It’s was an entry, First hack I going provide you is Word Press hacking.

First of all I’m going to share my photo gallery in this blog. I’m using Mac on my main working machine. That’s why I’ll going to create export plugin for Apperture and iPhoto to make share process easily for me.

See you soon, have a nice time.


Unique visitors to post: 16