Please use the form
% !TeX root = ../main.tex
For details see the TeXstudio user manual.
Background information on
These 'magic' comments were first introduced by TeXShop. Afterwards, other editors started to adopt them, including TeXworks, Texmaker and TeXstudio. There's no official standard. So capabilities, and tolerance towards capitalization and spaces may be different among the editors. The above form is the original one and should be accepted by all editors.
TeXstudio has an integrated root detection. If you have main.tex open and sub.tex included in main. It automatically detects that main.tex is the root document and thus compiles that even if the editor has focus on sub.tex.
It's still good practice to set
% !TeX root because then everything works even without an open root document. Additionally, your TeX files are more portable since AFAIK other editors do not support automatic root detection.
For further details see the user manual section on multi file documents.
%!TEX root = ../main.texa Texmaker's feature? I think you mean texworks?