How to Make a Frameless Qt Window

Frame in a window is the part of window that is crated and managed by the OS. It contains usually contains all borders and title bar of the window. To remove the frame of any window using Qt you need to use the following piece of code:

setWindowFlags(Qt::Window | Qt::FramelessWindowHint);

Note that this will also cause the title bar of the window to be removed which means there will be no “close”, “minimize” and “maximize” buttons. So, you can use this same piece of code to remove all buttons from the title bar.

Handling Duplicate Records in SQL

This happens a lot (to me at least 🙂 ) so I decided to make a note here!

Following SQL script will allow you to SELECT duplicate records in a given table.

SELECT * FROM my_table WHERE some_field IN (SELECT some_field FROM my_table GROUP BY some_field HAVING COUNT(some_field) > 1)

This code actually finds all the records in a table named “my_table” which have the same value for a field (or column) named “some_field” in more than 1 records which is specified in the final clause COUNT(some_field) > 1

To delete (remove) duplicate records you only need to change “SELECT *” to “DELETE”.

DELETE FROM my_table WHERE some_field IN (SELECT some_field FROM my_table GROUP BY some_field HAVING COUNT(some_field) > 1)