Online

Evgenij Legotskoj

EVILEG

Donate
Dec. 1, 2019, 2:22 p.m.

Qt

QWidget, Tutorial, Qt, Stylesheet

I suggest studying a small application in which a dialog box will be created, thanks to which the user can be trained in the functionality of your program, step by step explaining which program widget is responsible for what.

To implement such functionality, you need to create an application window that will have the buttons "Previous widget", "Next widget", "Close window". Before starting, widgets will be transferred to this window in the sequence in which they should be presented to the user in your program, as well as text messages that will describe the widgets.

The program will look like this:

Nov. 25, 2019, 5:53 p.m.

PyQt5

PyQt5, QObject, Qt, moveToThread, QThread

Based on one of the questions on the forum, I wrote an example on using QThread in PyQt5, as well as using the moveToThread method to move the class object of the inherited QObject to another thread.

In this example, a certain algorithm is executed, which returns the text through the signal, as well as the color of the text to the main GUI. This data is added to the QTextBrowser with a color setting.

The program will look as follows

Nov. 25, 2019, 3:35 p.m.

QML

clip, OpacityMask, ListView, QML

Quite often, the same question arises on the forum regarding the problem of displaying content embedded in any QML objects.

The most common manifestation of this problem is when ListView content scrolls beyond its scope. In any case, this is one of those frequent cases when beginners encounter this problem when starting to learn QML. Well, or another option when faced with such a problem when using Rectangle objects.

In the following image below, you can see two application windows that illustrate this problem.

  • The left window shows what the layout looks like initially
  • The right window shows that if you start scrolling through ListView content, it will go under the Title text, although it should have been cropped.

Nov. 22, 2019, 2:03 a.m.

Django

Django, SingletonModel, singleton, Model

Let's say you create a site with CMS based on Django, which must have some kind of dynamic site settings that will be available to the user. For example, the name of the site, some specialized information, while you take into account the possibility of multilingualism. What then can be used for this? I got the idea to use a database.

To implement this, the following is required:

  1. Creating a data model that will always contain only one object, that is, only one record. That is, it will be a Singleton Model.
  2. Prohibit deleting this entry and creating new ones in the Django admin panel
  3. The ability to use information from this model directly in the template, without loading the site settings in the view function.

Let's figure out in order how to implement this.

Nov. 9, 2019, 5:52 a.m.

PyQt5

QTableWidget, PyQt5

This will be a small update to the lesson on using QTableWidget in PyQt5

In the previous lesson it was shown how to display some kind of information in QTableWidget. And this lesson will also show how to make some cells editable and non-editable, as well as how to respond to keystrokes inside a QTableWidget

The application will look like this

Nov. 9, 2019, 2:42 a.m.

QML

Custom Button QML, QML, Custom

At the request of one of the users, I am updating one of the first lessons in accordance with the current status of Qt. Namely, a new lesson will be written using Qt Quick Controls 2.

Namely, we customize the appearance of our application so that the buttons look as follows.

Nov. 4, 2019, 5:15 a.m.

QML

Qt, QML, Signal, Slot, cpp

This article is the most comprehensive description of signals and slots in QML compared to all previous articles on this site.

In this article, I will try to explain the following when working with Qt/QML + Qt/C++:

  • ways to declare signals and slots, also called methods in the C ++ class, which will be registered in the QML layer
  • ways to connect to signals of classes declared in C ++ as context
  • work with Q_PROPERTY, which also requires signals and slots
  • ways to connect signals and slots in QML
  • etc.
Nov. 3, 2019, 4:03 a.m.

Django

ESNF-C, Django, model_cached_property, EVILEG

To speed up the site, in addition to optimizing database queries, you can use caching.

Django allows you to cache:

  • individual view , both Class Based View , and ordinary functions view
  • whole templates or parts of these templates
  • QuerySet
  • as well as properties of model objects using cached_property

I was interested in the ability to cache individual properties of model objects for heavy computing or heavy database queries.
The cached_property decorator has such a functional, but the drawback for me was that caching occurred only for the lifetime of the object.
Whereas I need caching for a longer period of time than the existence of an object when requesting a page. And also I needed to cache properties depending on the input arguments. This decorator on the site caches the number of likes and dislikes, as well as information about whether the current user liked a particular content object.

Thus the decorator model_cached_property was written

Oct. 27, 2019, 4:56 a.m.

Django

Google, reCAPTCHA, EVILEG, CORE, ESNF-C

This will be the first article on the use of a set of established utilities that are present in the core of the EVILEG site. This part of the site’s program code is in open source, so I want to talk about what functionality is present in this battery and how to use it.

I'll start by using Google reCAPTCHA , and what is required to quickly implement this functionality.

Oct. 27, 2019, 4:55 a.m.

EVILEG

ECNF-C, Django, EVILEG, Releases, Python

Introducing the new release of EVILEG-CORE 0.0.5.

Donate

Hello, Dear Users of EVILEG!!!

If the site helped you, then support the development of the site financially, please.

You can do it by following ways:

Thank you, Evgenii Legotckoi