fractorium/Source/Fractorium/TableWidget.h
mfeemster b690bf8071 --User changes
-Remove the option --intpalette to format the palette in the xml as ints. If they are not hex formatted, then they should always be float. This option was pointless.
 -Cleanup some options text for the command line programs.
 -Allow for dragging around flames in the library tab. This is useful for setting up the order of an animation.
 -Make the opening of large files in Fractorium much more efficient when not-appending.
 -Make the opening of large files in all EmberRender and EmberAnimate more efficient.
 -Better error reporting when opening files.

--Bug fixes
 -Get rid of leftover artifacts that would appear on preview thumbnails when either switching SP/DP or re-rendering previews.
 -Filename extension was not being appended on Linux when saving as Xml, thus making it impossible to drag that file back in becase drop is filtered on extension.

--Code changes
 -Move GCC compiler spec to C++14. Building with 5.3 now on linux.
 -Use inline member data initializers.
 -Make a #define for static for use in Utils.h to make things a little cleaner.
 -Make various functions able to take arbitrary collections as their parameters rather than just vectors.
 -Make library collection a list rather than vector. This alleviates the need to re-sync pointers whenever the collection changes.
 -Subclass QTreeWidget for the library tree. Two new files added for this.
 -Remove all usage of #ifdef ROW_ONLY_DE in DEOpenCLKernelCreator, it was never used.
 -Add move constructor and assignment operator to EmberFile.
 -Add the ability to use a pointer to outside memory in the renderer for the vector of Ember<T>.
 -Make a lot more functions const where they should be.
2016-04-03 18:55:12 -07:00

58 lines
1.9 KiB
C++

#pragma once
#include "FractoriumPch.h"
/// <summary>
/// TableWidget class.
/// </summary>
/// <summary>
/// The entire purpose for this subclass is to overcome a glaring flaw
/// in the way Qt handles table drawing.
/// For most of the tables Fractorium uses, it draw the grid lines. Qt draws them
/// in a very naive manner, whereby it draws lines above the first row and below
/// the last row. It also draws to the left of the first column and to the right
/// of the last column. This has the effect of putting an additional border inside
/// of the specified border. This extra border becomes very noticeable when changing
/// the background color of a cell.
/// The workaround is to scrunch the size of the table up by one pixel. However,
/// since the viewable area is then smaller than the size of the table, it will scroll
/// by one pixel if the mouse is hovered over the table and the user moves the mouse wheel.
/// This subclass is done solely to filter out the mouse wheel event.
/// Note that this filtering only applies to the table as a whole, which means
/// mouse wheel events still get properly routed to spinners.
/// </summary>
class TableWidget : public QTableWidget
{
Q_OBJECT
public:
/// <summary>
/// Constructor that passes the parent to the base and installs
/// the event filter.
/// </summary>
/// <param name="p">The parent widget</param>
explicit TableWidget(QWidget* p = nullptr)
: QTableWidget(p)
{
viewport()->installEventFilter(this);
}
protected:
/// <summary>
/// Event filter to ignore mouse wheel events.
/// </summary>
/// <param name="obj">The object sending the event</param>
/// <param name="e">The event</param>
/// <returns>True if mouse wheel, else return the result of calling the base fucntion.</returns>
bool eventFilter(QObject* obj, QEvent* e)
{
if (e->type() == QEvent::Wheel)
{
e->ignore();
return true;
}
return QTableWidget::eventFilter(obj, e);
}
};